Remove invalid optimization in checkGlobals function.