applied patch from David Schleef <ds@schleef.org> which implements a