fixed a memory leak
more memory leak fixes