Backport fix #922