backports from master