moved mismatch update closer to where it is used