CSW: backport all recent patches