small memory leaks fixed