logic fix for checking win condition