a patch from Yannick Scherer