The fact is, he had to distinguish between two different people named Joseph - Matthew is not referring to Mary’s husband in verse 16 at all, but rather her father!
Depending on context, it has been shown that 0rbg can mean ‘man, husband or father.’ The usage in verse 16 would demand that we translate 0rbg as ‘father’, rather than 'husband', since the context is a genealogy. Verses 18 & 19, however, would demand that we associate that Joseph with her ‘husband’, since the context is that of marriage. Matthew, then, is recording the genealogy of Mary, whereas Luke is recording that of Joseph. Which would be exactly opposite of the currently accepted academic line (which was somewhat detailed in my previous post) - that Luke recorded Mary’s lineage while Matthew recorded that of Joseph. That would give us 14 generation in the third series of Matthew. It would also explain why Luke has 20 generations in the 2nd series and 22 generations in the 3rd series - i.e., Joseph's lineage did not break out cleanly in 14-generation groupings, except for the first series. Since Matthew is giving the line of Mary, only her lineage would be required to break out evenly in 14-generation groupings. That would also explain why the names are completely different in both the 2nd and 3rd series between the accounts in Matthew and in Luke. It also demonstrates that both Mary and Joseph were descendents of King David - each through a separate line!