Remove $nin from count() (slooow), bugfixes

$nin is way too slow for the count code. It's probably also way too slow
for the other queries.

Also fixed a couple of bugs.
Merge branch 'master' of https://github.com/kbase/metrics