modify set_matched_idxs_inner