fix memory leak caused by merging new