Patch by Harald, seems a bit magic