Viterbi checking. not debugged.