bugfix when resize the window