fix NPE when combining count&distinct for pull request #32