MsMerge_genhistory has alot of rows with pubid = null
I have found out that since i use anonymous subscribers the publication will take ownership of all changes and it will not set a pubid for its changes. the only row that the subscriber adds is a row with artnick = 0. So if the subscriber adds changes the subscriber will only have one row and it will have a valid guid for the publication but the row does not point to any changes. instead the publication will add the changes as if the originated there. 

The problem with the metadata cleanup was not related to the null values, it was orphaned subscriptions. If an anonymous subscription is created from one of our handheld devices and is not synced, it caused the cleanup to exclude generations. This is added with sp2 in sql2012 and the cleanup creates a list of excluded generations that are "active" the problem is that if a subscription in sysmergesubscriptions has null in last_local_sentgen it will add all generations between 1 and sentgen to the exclude-list and the metadata does not get cleaned. I have tried to remove these subscriptions in my test environment and now i can see the cleaning is being run properly. I can also see that this can also happen if a subscription-creation does timeout. The subscription can be created but the database in the handheld is not downloaded the subscription becomes orphaned and never synced. 

Hope this helps someone.