Thanks for the hints, Stefan. The attached patch seems sufficient in my tests. Do you see any problems with it? -- Simen