global variable fixes (found via th -g)