mem leaks fixed