Ios8 fixes

Merge in upstream ios 8 fixes as well as Rogelio's fixes for orientation changes.