Or source skinWeightsIOUI.mel and type skinWeightsIOUI.
It reads the weights by name, not by index.
That means, the order, in which the influences are bound before importing, can differ from the one before exporting.
That means you export, detach, change joint-hierarchy, import again, still working.
that way you can also swap weights:
export, change joint-names, import, change joint-names again, done!