Backport fix for #913