More scoping fixing