fixes to make it work on mac os x 10.9 mavericks

fixes to make it compile on Mac OS.X 10.9 mavericks.