Fix bug in Stats calculation