fix more query stuff