fix scoping error