edit/add memory leaks fixed