Fixed global var leakage