fix defect where required and pattern errors could display at the same time