Backport fix for #836, who got lost for whatever reason