fix the pattern match