windows: several fixes