Correct some mistakes in pattern matching