Add missing $g to global, as noted on pull request 1249