Patches written by Jérôme Suhard, copied from http://suhard.fr/gate/patches/