Avoid using "undefined" in head and body of new document.