Fix issue that scopes with same name got overridden