when replace the distance with smaller values