fixed bug in count_score()