Fix a bug in statistics computation.