fix memory leak introduced by previous gc fix