Make doc.write be able to accept multiple args

document.write can accept many arguments. This patch fixes this issue.