fixed hmm bug