diff --git a/xCAT-nbroot/overlay/bin/getdestiny.awk b/xCAT-nbroot/overlay/bin/getdestiny.awk
index 144a169c0..df58c12e9 100755
--- a/xCAT-nbroot/overlay/bin/getdestiny.awk
+++ b/xCAT-nbroot/overlay/bin/getdestiny.awk
@@ -3,6 +3,7 @@
 BEGIN {
   localport = ARGV[1]
   ns = "/inet/tcp/0/127.0.0.1/" localport
+  canexit = 0
 
   print "<xcatrequest>" |& ns
   print "<command>getdestiny</command>" |& ns
@@ -11,7 +12,9 @@ BEGIN {
   while (1) {
     if ((ns |& getline) > 0) {
       print $0 > "/tmp/destiny"
-      if ($0 == "</xcatresponse>")
+      if ($0 ~ /<\/serverdone>/)
+        canexit = 1
+      if (canexit == 1 && $0 == "</xcatresponse>")
         break
     } else { #Timeout
         close(ns)
diff --git a/xCAT-nbroot/overlay/bin/getipmi.awk b/xCAT-nbroot/overlay/bin/getipmi.awk
index 82a7ffb6e..57778ca08 100755
--- a/xCAT-nbroot/overlay/bin/getipmi.awk
+++ b/xCAT-nbroot/overlay/bin/getipmi.awk
@@ -3,6 +3,7 @@
 BEGIN {
         localport = ARGV[1]
         ns = "/inet/tcp/0/127.0.0.1/" localport
+        canexit = 0
 
         print "<xcatrequest>" |& ns
         print "<command>getbmcconfig</command>" |& ns
@@ -11,7 +12,9 @@ BEGIN {
         while (1) {
                 if ((ns |& getline) > 0) {
                         print $0 > "/tmp/ipmi.data"
-                        if ($0 == "</xcatresponse>") 
+                        if ($0 ~ /<\/serverdone>/)
+                            canexit = 1
+                        if (canexit == 1 && $0 == "</xcatresponse>")
                                 break
                 } else {
                    close(ns)
diff --git a/xCAT-nbroot/overlay/bin/nextdestiny.awk b/xCAT-nbroot/overlay/bin/nextdestiny.awk
index 0f18eac4d..5488b2293 100755
--- a/xCAT-nbroot/overlay/bin/nextdestiny.awk
+++ b/xCAT-nbroot/overlay/bin/nextdestiny.awk
@@ -3,6 +3,7 @@
 BEGIN {
   localport = ARGV[1]
   ns = "/inet/tcp/0/127.0.0.1/" localport
+  canexit = 0
 
   print "<xcatrequest>" |& ns
   print "<command>nextdestiny</command>" |& ns
@@ -11,7 +12,9 @@ BEGIN {
   while (1) {
     if ((ns |& getline) > 0) {
       print $0 > "/tmp/destiny"
-      if ($0 == "</xcatresponse>")
+      if ($0 ~ /<\/serverdone>/)
+        canexit = 1
+      if (canexit == 1 && $0 == "</xcatresponse>")
         break
     } else {
         close(ns)