Fixed win detection bug