fix leaking global