Fix two crashes