Bugfix count query.