Memory leaks fixes.