backport from master