fix x/o global variable issue