patched with PR from @ssimono