additional memory leak fixes