fixed a bug in statistic calculation