fix memory leak in pop, I think