Fixed error in scoping