Fix bug of resizing image