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