repair memory leak