Solved: document.write destroys all document including the callback