imported model's vertex groups mess up after removing doubles?

This is a thing I noticed only for the Blender 2.5+ API, doesn’t seem to be a similar issue with Blender 2.4.
I’ve written an importer for a format which only supports individual triangles, in other words the imported model always has double vertices.
That’s not a problem: the importer has a checkbutton for removing doubles during import and you can remove doubles later of course.
However, when you do that (remove doubles, either manually or via the script), the vertex groups (used for the models with bones) really mess up, only few vertices from completely random places of the model for each vertex group.

I don’t notice the same problem with the importer for Blender 2.4.

I can post some example code if needed, however I don’t want to overcomplicate this post if there is something obvious changed in Blender 2.5 which causes this.