fixed up scoping issue