fix bugs and screen orientation change behavior