<do_all exact="$formerstoragecount.count" counter="$b">
<add_cargo exact="$formerstoragecount.{$b}" object="$PMCEXCHA.{$i}" ware="$formerstorage.{$b}"/>
</do_all>
where "$formerstoragecount is a list of integers.
$formerstorage is a list of wares.
and $PMCEXCHA.{$i} is one instance of a station from a list of such station types (that is currently being iterated through).
my patch works but it doesn't transfer the full amount of wares from the previous storage container. Using debug_text, i can confirm that the values in the list are correct at that it's the "add_cargo" (function? object? method?) that's not working correctly.
Station before patch:

After (as you can see, some of my more...discretely acquired goods are now missing):

For now i'll try emptying my "warehouse" of Spaceweed and Narcotics, and pray that the other wares won't also be affected after i changed the possible wares. However, i'm afraid that the imperfect transfer will affect NPC stations (stations being patched are Plutarch Exchange and Warehouses, and only the liquid and energy storage for warehouses, so Teracorp might lose some resources from the patch).