Fix value range determination code so the heaps are always in heap order

Fix value range determination code so the heaps are always in heap order.

Merge request reports

Loading