fix crash when rotating