fixed scoping error