Fix active scopes; add tests
Fix save bug