change item index to row index