possible solution to memory leak