This is a remake of the patch from issue #10347 but based on current master. Works for me on Lubuntu 17.04. Fixes: #10347