Fix bug in statistics