fixing wrong loop on NodeIterator's traversal