Proper HTML detection, fixed S3 uploading