Solved the bug when rotating screen.