Fix issue of resize event