Fix from @mourner for iOS 7 Safari crashes.