Fixed win-checking bug