Add document.write for error