Mavericks fixes

A few fixes that I had to make to trunk to get it to build on OS X 10.9.