check if an entity has been deactivated already before deactivating

It is a little slower, and could be done in application space but much safer