Fixes for incompatibilities with Mac and Linux