Fix bugs when image width/height are null