fix the bad index