fix memory leak in last commit