Added patch from Didier Bringer