Fixes #5692 - correct counts in cached_counters
Fixes #7247 - Add migration and rake task to correct corrupted cached counters