Fixed bug related to global variables

Bug was breaking some systems and not others. Tested on one system, need
to test on others.