fix more resource leaks