repair a big memory leak