Couldn't find the reason for the crash on exit