Fix broken restarts when the app dies unexpectedly.