Fix 'global is not defined' error. Thanks dlkulp.