combine pattersn into one, fix a bug