Fix for matchProblems

Needed to take into account that later matches could affect earlier
problems.