Misc changes to support  Xcode5 and IOS7

see commits for details