Fix transitionProbs and pi

Fix the transition probabilities and pi calculations.