some cleanup of entities