Backports from patches.