Fixed bug in win checking.