refine patt output.