small fixes to the win function