implemented crash handling (FINALLY)