Globals leak fixed