folly: simplify the stats avgHelper() function