Backport changes to 1.56 as some of them are needed to avoid a broken release on 1.56.