iOS 8 fix

Solution proposed by @jasson112