Fixing some global var problems
Fixing some global var problems..