fixed some api errors

fixed warnings and errors with Xcode 4.6, iOS 6 and MacOS 10.8