Fixed a numerical instability issue in the matching algorithm.
Merging new matching fixes.