fix bugs of viterbi inference