fixed bug in maximum score calculation