Some fixes for compatibility with iOS 7