Fix filter cache stats calculation

Fixes #2609