No longer crashes on exit