Comment 34 for bug 880533

Harald Judt reverted his previous fix and added a new one upstream today.
I imagine launchpad will import his comments here soon. In the mean time,
here are his latest two patches backported to ubuntu 14.04.