fix memory leak in global pd