fix the bug of index number is in the last position