fixed bug that crashed app on real hardware during orientation change