Fixed error handling in Xcode 4.6+.