windows: actually fix #8413 and maybe fix #7982 also