Fix NullPointerException when referencing an already deleted ent

NullPointerExceptions could happen when logging a debug message
related to an entity that has already been removed from the
EntityCollection.