Fix switch_scope