fix performance on findFirstMatch