diff --git a/xCAT-UI/lib/cmd.php b/xCAT-UI/lib/cmd.php
index 73d9fed10..599188661 100644
--- a/xCAT-UI/lib/cmd.php
+++ b/xCAT-UI/lib/cmd.php
@@ -67,7 +67,12 @@ if (isset($_GET["cmd"])) {
foreach ($child->children() as $data) {
if($data->name) {
$node = $data->name;
+ if($data->data->contents){
$cont = $data->data->contents;
+ }
+ else{
+ $cont = $data->data;
+ }
$cont = str_replace(":|:", "\n", $cont);
array_push($rsp, "$node: $cont");
} else if(strlen("$data") > 2) {
diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php
index ae6f88142..e9a26e420 100644
--- a/xCAT-UI/lib/functions.php
+++ b/xCAT-UI/lib/functions.php
@@ -67,8 +67,8 @@ function submit_request($req, $skipVerify){
fwrite($fp,$req->asXML()); // Send XML to xcatd
while(!feof($fp)){ // Read until there is no more
// Remove newlines and add it to the response
- $response .= preg_replace('/\n/', ':|:', fread($fp, 8192));
-
+ $response .= fread($fp, 8192);
+ $response = preg_replace('/>\n\s*', '><', $response);
// Look for serverdone response
$fullpattern = '/\s*\s*<\/serverdone>\s*<\/xcatresponse>/';
$mixedpattern = '/\s*<\/serverdone>.*<\/xcatresponse>/';
@@ -80,6 +80,10 @@ function submit_request($req, $skipVerify){
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
if (!$count) { $response = preg_replace($mixedpattern,'', $response) . '/'; } // if its not there, then remove the short pattern
$response = "$response";
+ //delete the \n between '>' and '<'
+ $response = preg_replace('/>\n\s*', '><', $response);
+ //replace the '\n' by ':|:' in the data area.
+ $response = preg_replace('/\n/', ':|:', $response);
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
$cleanexit = 1;
break;