more memory leak fixes