fix ie and document.write