Mean function overrides keep function and removed wanted data

So when I ran a sample query similar to the one below, the mean() function overrides my keep() function setting and removes almost all of my needed data.

from(bucket: “A”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: ® => r["_measurement"] == “B”)
|> filter(fn: ® => r[“C”] == “D”)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: “_value”)
|> group(columns: [“groupby”])
|> keep(columns: [“groupby”, “F”, “G”, “H”, “data”, “geohash”, “link”])
|> map(fn:® => ({ r with data: int(v: }))
|> mean(column: “data”)

The problem is that when I use mean, columns F, G, H, geohash, link are all removed and only groupby and data column gets displayed. This is extremely annoying as those columns are set there because I need those data, data such as geohash and links to be used elsewhere by application webpage. I’m not sure if this is a bug or a mistake in flux, but it certainly is frustrating. (btw, all the data in the columns F, G, H, geohash, and link are the same for the same groupby value)

If a solution can be found to make this application more useful it’ll definitely be of big help. Thanks.