Fix bugs in iOS 7

See source: https://devforums.apple.com/message/871619#871619