Mike's memory leak fixes.