Fix statistic used for certain metrics

Currently a WIP, this pull request is up for review.