fixed a memory leak issue