change index from idx to idx-1.

which accords with list-index