Fixed problems so it runs on Linux but broke OSX.
Problems with previous commit not showing up