Fix some issues with the last stats.cpp fix.