fix crash when rotating the screen