correctly renumber MI when copy-paste bug #10192

This should fix bug #10192.
If someone can review... I'm not completly sure of my sql queries, and I don't want to break some other things.