added cursor support for aggregation