Various minor backports.