count query fix
Merge pull request #868 from wmathurin/unstable

Count query fix