Backport 3130

Backport #3130 for 1.7.1