Backport fix for bgo#729280 to 1.8