Fixed errors in transition matrix creation