Fixed bug in score calculation