Backport #1013