Correctly handle empty scopes