matching algorithm fixes from tck