Hacks to remove crash on exit