Minor changes to make it work in iOS 8