Tweak to work in iOS8.
Had to change the handling in pre-iOS-8 to work properly.