Fix queryBuckets