Fix count serialization

Fixes #1015 
That's fine as well. Then it's good to merge in my opinion.