reduced the number of memory leaks