crash detection logic corrected