Fix a variety of bugs caused by forced reboots.