better xml write out