Bug fix where the root scope may not be window