Reapplying pull request #77 from @rvagg after testing on ubunut
2.1.2