update the index of each row