fixed memory leak related to dead object pointer