Use flag remove global variable.