fix searching by range

it was returning duplicates