ObjectManager improvement: handle events before destroying objects (thanks to Moritz Lenz).