Got it!

You need the number of vertices including the vertices that are duplicated due to the skin uvs.

Replace:
int vertices1=ent_vertices(source1);
int vertices2=ent_vertices(source2);

with
int vertices1=ent_status(source1,1);
int vertices2=ent_status(source2,1);

Now, I hope to find a way to include the position, scale and rotation of the models.
Last point is to use the different skins as well.