Some fixes for statistics