diff from florian@; I am using a slightly different diff from upstream here (also tested by florian@).