fix the match group detection