set references to NIL when deleting an object