bug fixes to the heat map construction