Fixed queries in getdistribution
Fixed queies in getfrequentwords