modified count call in aggregate