Fixing bugs of not having global variable.