Fix issue of global variable