Fix for crush on exit