fixed bugs in statistics