fixed memory leak (double freed or corrupted memory)