Fixing aggregates and a lot other types of queries.