fix two crashes