There is one problem.
if (gi.csi->currentMD && strcmp(gi.csi->currentMD->id, "ufocrash") == 0) {
So, this applies only to ufocrash map. But now crashed ufos can be at other maps, so this condition should be changed.
(IMO ufotype of mission should be compared with "craft_crash_*").