add GLOBAL flag to solve the Global Variable Problem