Fixed sorting of heatmap data