fix bug in nextNodeNumber()