Backport #991