fixed another global variable issue