fixed error in resizing images