Fix crash when rotate the display.