Fix a bug with html decoding errors.
Fix a bug with image where type detection fails.