fix a bug on calculating total score