correct index in function calculating score