Patch from tobes@github.com