Corrected bug that caused the same object to be deallocated twice