fix memory leak introduced in the last commit