Fixes xml write