Bug fixes to heat map and markov calculation