Setting IP address on one of the multiple found cameras

I have an issue that I can not set the IP on a specific camera - I only get the nodemap from the first device event though I use the DeviceUpdateList-command.
I want to set the IP-address to 192.168.20.51 to the camera that I found with my connection_id.
I found the camera as the 2nd camera in the deviceList. I try to do what is shown in how-to-set-a-the-ip-address-of-gev-camera-programmatically-in-cvb but something is not working as expected for me, and the IP is set on the first camera in the deviceList.

Here is my code:

logger->info("Found devices:");
for (auto &deviceInfo : deviceList)
{
    PrintDeviceInfo(deviceInfo, logger);
}

logger->info("{} available devices to connect to", deviceList.size());

for (auto t : deviceList)
{
    auto selectedCamera = SelectDevice(t, connection_id, logger);
    if (selectedCamera != nullptr)
    {
        logger->info("Camera found using {}: ", MimerUtils::ToString(t));
        PrintDeviceInfo(*selectedCamera, logger);

        std::string deviceMAC, deviceIP, nicIP;
        selectedCamera->TryGetProperty(Cvb::DiscoveryProperties::DeviceMac, deviceMAC);
        selectedCamera->TryGetProperty(Cvb::DiscoveryProperties::DeviceIP, deviceIP);
        selectedCamera->TryGetProperty(Cvb::DiscoveryProperties::InterfaceSubNetList, nicIP);
        fixMACAddress(deviceMAC);
        fixNICIP(nicIP);

        int a = 0, b = 0, c = 0, d = 0;
        sscanf(nicIP.c_str(), "%d.%d.%d.%d", &a, &b, &c, &d);

        char tmp[17];
        d = (d + auto_set_ip) & 0xFF; //New IP is same as nic with last part offsetted
        sprintf(tmp, "%d.%d.%d.%d", a, b, c, d);
        std::string ip_str(tmp);

        logger->info(" Configuration is requesting that device shall have IP {}", ip_str);
        logger->info("  DeviceMac: {}", deviceMAC);
        logger->info("  Trying to set camera IP to: {}", ip_str);

        auto access_token = selectedCamera->AccessToken();
        auto device = Cvb::DeviceFactory::Open(access_token);
        auto nodemap = device->NodeMap("TLInterface");

        // get all required nodes
        auto deviceUpdateListNode = nodemap->Node<Cvb::CommandNode>("DeviceUpdateList");
        // make node map aware of the device
        deviceUpdateListNode->Execute();

        auto deviceIDNode = nodemap->Node<Cvb::StringNode>("DeviceID");
        auto deviceMacNode = nodemap->Node<Cvb::IntegerNode>("DeviceMAC");
        auto cfgIPNode = nodemap->Node<Cvb::IntegerNode>("Cust::IPCfg_IP");
        auto cfgSubnetNode = nodemap->Node<Cvb::IntegerNode>("Cust::IPCfg_Subnet");
        auto cfgMacNode = nodemap->Node<Cvb::IntegerNode>("Cust::IPCfg_MAC");
        auto cfgForceNode = nodemap->Node<Cvb::CommandNode>("Cust::IPCfg_SetForceIP");
        auto cfgStaticNode = nodemap->Node<Cvb::CommandNode>("Cust::IPCfg_SetStatIP");

        //Diagnostic printout
        {
            auto mac_verification = deviceMacNode->Value();
            auto mac_str = macToString(mac_verification);
            std::cerr << deviceIDNode->Value() << " " << mac_str << std::endl;
        }
        {
            auto mac2 = device->NodeMap("Device")->Node<Cvb::IntegerNode>("Std::GevMACAddress")->Value();
            auto mac_str = macToString(mac2);
            std::cerr << mac_str << std::endl;
        }

        // we want to configure the found device
        cfgMacNode->SetValue(deviceMacNode->Value());
        // IP 10.0.0.1 (given that your NIC has a suitable address like 10.0.0.2)
        uint32_t ipInt = (a << 24) + (b << 16) + (c << 8) + d;
        //auto str = ipToString(ipInt);
        cfgIPNode->SetValue(ipInt);
        // Subnet 255.255.255.0
        cfgSubnetNode->SetValue(0xFFFFFF00);
        // // Force the new IP
        cfgForceNode->Execute();
        // // // make node map aware of new IP
        deviceUpdateListNode->Execute();
        // // // permanently write the IP to the camera
        cfgStaticNode->Execute();
    }
}

and the relevant output of the code:

[info] connection_id: G-KBS41D2001012
[info] Found devices:
[info] Photonfocus AG MV1-D2080-C040-160-G2-12 (SN: 072100024891, addr: 00:11:1c:f5:a8:d9/192.168.20.251) in interface 24:5e:be:4d:9a:7f/192.168.20.1.
[info] Tucsen Dhyana 401A-G (SN: G-KBS41D2001012, addr: 70:b3:d5:8a:70:0c/192.168.20.5) in interface 24:5e:be:4d:9a:7f/192.168.20.1.
[info] Tucsen Dhyana 401A-G (SN: G-KBS41D2001013, addr: 70:b3:d5:8a:70:0d/192.168.20.2) in interface 24:5e:be:4d:9a:7f/192.168.20.1.
[info] 3 available devices to connect to
[info] Camera found using DeviceId:
[info] Tucsen Dhyana 401A-G (SN: G-KBS41D2001012, addr: 70:b3:d5:8a:70:0c/192.168.20.5) in interface 24:5e:be:4d:9a:7f/192.168.20.1.
[info] Configuration is requesting that device shall have IP 192.168.20.51
[info] DeviceMac: 70:b3:d5:8a:70:0c
[info] Trying to set camera IP to: 192.168.20.51
::ID->00-11-1C-F5-A8-D9::192.168.20.251 d9:a8:f5:1c:11:00
70:b3:d5:8a:70:0c

The thing that tells me that something is malfunctioning are the two last lines in the output that I added for diagnostics.
The deviceIDNode->Value() and mac_str matches the first camera in my deviceList and not the camera that is in “device”.
The device->NodeMap(“Device”)->NodeCvb::IntergerNode(“GevMACAddress”)->Value is the correct one.

It works fine to stream images from the “device” correctly so I reckon I must do most of the things the right way.