Fixing broken OS X behaviour and adding test.
Merge pull request #2 from rmca/osx-tailfix

Fixing broken OS X behaviour and adding test.