Applying fix for #227 - verifies that the criteria object is used in `count`

Fixes #227