Backport #5551 to 1.1