Fixing a bug with the code that handles application's scopes.