Improve support for iOS 5 and 6