fix aggregation query for languages stats