fix working with patterns