Added underflow handling for Viterbi