fixed indexing error in hasWon