Get item count from ngroups rather than matches (fixes #405)