Fixed an algorithmic problem with the Viterbi decoder