Backport #1072