Fixes #76: fix_counts does not work when using primary_key

Fixes #76: fix_counts does not work when using primary_key