Fixed crash in VALID_MAGIC with NULL object