fix a small bug of resizing window