fix incorrect reference to global variable