Fix nested matching.