Fixed buggy Viterbi algorithem