fixed memory leaks again