fix memory leak in previous