Applied Stephane Carrez <Stephane.Carrez@worldnet.fr> patches to add support