Fixed HXP.next(), as it was using max() for the non-looping branch inste...

...ad of min()