update tests, fix more bugs