Some 10.8 SDK compatibility fixes.  Weirdly Xcode could build the project but on the commandline and in AppCode it failed.