For some reason empty buckets were getting into the query. This could be filtered out at the `/query` endpoint but it was easier to just do it here.