fixed index out of bounds with score