Improve and fix caching counters for statistics