Fix scoping semantics