Fixed training and r/w bug

Fixed an error introduced in the last version where training was slowed
down because some variables were not cast. Also fixed the reading and
writing errors.
Merge branch 'master' of https://github.com/jmschrei/yahmm