Memory leak fixes.