Fix longest match.