Fixed document.write problem