Add acceptance test. Fix bug with patterns.