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