Fixes #63: fix_counts does not work when using primary_key

Both primary_key possibilities need to be taken into account:
 - on the table that holds the counter
 - on the table of counted records
Can we check that this actually works correctly? I.e. set the count to something wrong, run fix_counts and then ensure it is now right?