Fix device rotation issue