fix more warnings and a couple bugs introduced by automatic refactoring