fix bug when isFitWidth and resizing window