Fix warning, fix memory leak