fixed a memory leak