changes in Function.win() to handle more rare cases