support groupBy, Sum, Avg, Min and Max aggregate queries
fix constructor check