Backport #1042