Handle node ranges better when dealing with accounting max node limits.

This is for bug 775