memory leak attempt to solve