Fixes for stats logging