Remove invalid optimization in checkGlobals().
Merge pull request #1110 from noshir-patel/globalsfix

Remove invalid optimization in checkGlobals().
Automatically rewritten for npm.