Fixed some compile errors on Mac and unit tests run on mac.