fixed bugs in the score calculation