backport 5ee034ba610e24728566cb098d87b0e25753b927