misc memory leaks fixed