added check for win function