Fix a couple of crashes