fixing scoping