fix bug when rotating the screen