Fixed bug that causes crashes when removing objects from the scene.