Backport fix #933