Fix some bugs in existing node lookup / duplicate relationship creation.