backport ffb50a23f11bd07385ab2b6c42105cf654264f63