fixed issues with removing targets when objects are being deallocated