Fixed global variable leak