Fixes to deleting entities

Recent changes from #27 inadvertently introduced a bug, which made it impossible to delete an entity if it weren't loaded first