Issue #301 - Validate consistency of count_by