finally fixed the document resize issue