implement missing isWin() function