fix memory leak & build break