PetScan::mark_write: handle NULL access