a few more memory leak fixes