Fix bug when opening/closing keyboard and orientation is not determined yet.