Dynamic plugin IDs?

I’m pulling my hair out trying to write an application that will clone an AU without any ID conficts. My normal modus operandi is to simply copy the plugin, search the plugin binary data for a known pluginID and swap it with a new one. This all works quite well with VSTs but not with AUs. As soon as I modify the AUs binary data it stops being recognised by auval. I really need to be able to clone my AUs without having to recompile them all. Anyone have any ideas?

Turns out I also need to modify some other binaries that get created. Modifying just the plugin lib was not enough. All sorted now.