Fixed the mac build and some other errors with older compilers.