Fix regression in winding function