memory leaks fixed