fixed a memory leak bug