fix memory problem.