change index to min