fix transition matrix bugs