Correct index bugs in viterbi