Thomas, Your patch has the right diagnosis, although I would write it a tad differently. NCH(n) <= i + 2 should be NCH(n) < i + 2, because CHILD(n, NCH(i)) is not valid. I'll check it in. Jeremy