fix some bugs with alignment match detection and broken emisison model in tests.  also some idnexing issues for nested states