Fix memory access on a deleted object