"Set" node on map, unexpected behaviour


I’m trying to create a compare functionality where a map filled with data is compared against default system data. The compare algorithm I use is working (I think) but I’m having an issue with the map behavior that is unexpected.

The system map data remains the same while I’m trying to find a match through the other map. I have an array of structs with a map (and some other data) inside. This map is then extracted and compared against the system map data, all inside a for loop for each element of my array. To override the map and prepare it for comparing, I use the “Set” node. While debugging I noticed that the map data isn’t completely overridden. If the previous map had an extra key-value pair. This key remains in the overridden map data, just without it’s value. This causes my compare function to throw a false when comparing because this key isn’t present in the system data.

Is this normal behavior for the “Set” node for a map?
I know the “Add” node checks if the same key is present and simply overrides it if so and adds a new key-value pair if not. I’m guessing the “Set” node uses the same logic to override the map.

The only solution I see is “Clear” my map and then setting it again.
I just wanted to ask if this is normal behavior for the “Set” node