Added checks so we don't freak out when asking for prevUrn or nextUrn on the first or last node.