make sure rest does not get messed up, fix more unit tests