Do not use document for errors if it's undefined
Allow Html through main