Improved stability when deleting object instances

and removed the debug code that I left in