Fixed xml output routine (buffer overrun)