fixes and support for both linux and osx