fixed some hmm bugs