Fixed referencing id[-1] in case of the first node.