correctly fix memory problem
correctly fix memory problem