refactoring statistics

fixed some bugs