patch by: Vincent Untz <vuntz@nome.org>