fixed crashing bug related to object removal