fix memory problem