fixing accidental global variable