Adding a few fixes.

Support for Mac + Linux, and some hanging issues.