bug fixes to support deleting objects better