Possible fix crash on exit.