fix scoping issue