Fix a few lurking crashes.