Fix a couple of crashes introduced in the last commit