Backport #436.