fix memory leak problem