Fixed statistics functionality for variables with data transformations.
Fixed formatting of a function signature
Reverted an incorrect merge edit, which deleted some patches to the statistics code