backport fix from v2