Fixed a bug in trainhmm.m