updated XML output with null fix