Fixed a numerical instability issue in the matching algorithm.