Fix a few crashes.