Prevent out of bounds exceptions if an entity is not removed properly.