Memory leaks fixing.