Avoid using count() if not really needed
Merge pull request #238 from wmde/countperf

Avoid using count() if not really needed