solved memory leaks