Fix a couple of crashes found by crashlytics