fix memory leak in profile