restart handling and crash detection