fix memory leak warnings