Fixed crash in object destruction