fixed error on resize