Fix leaking global variable