Fix scoping issue apparent under integration test