fixed infinite loop after screen rotation