fixes #18 thanks to @hensb for the patch from jensb@b853867