Patch from Mark Wooding (though somewhat tampered with by me): have