fixing app crashes on orientation change