minor change to matching algorithm