More memory leaks fixed