fixed counting bug about statistics