Fix Memory leaks