Fixing hidden global variable?