Fix loop index error in leaderboard.js