fix row index bug