Fixing scoping issue