fixed the bug that references an object after it was destroyed.