fix check_scope_level