inserted if/else check into hmm.py