Fix compilation when stats are not enabled.

If macro `STATS_NEEDED` is not defined, then the file does not correctly compile.
This change fixes the problem.