removed memory leaks