diff --git a/src/switch_xml.c b/src/switch_xml.c
index ab69754241..82a3a0810a 100644
--- a/src/switch_xml.c
+++ b/src/switch_xml.c
@@ -966,16 +966,16 @@ static int preprocess(const char *file, int write_fd, int rlevel)
 			}
 		}
 
-		if ((cmd = strstr(bp, "<!--#"))) {
-			if(write(write_fd, bp, (unsigned) (cmd - bp)) != (cmd - bp)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
-			}
+		if ((cmd = strstr(bp, "<!--#"))) {
+			if(write(write_fd, bp, (unsigned) (cmd - bp)) != (cmd - bp)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
+			}
 			if ((e = strstr(cmd, "-->"))) {
 				*e = '\0';
-				e += 3;
-				if(write(write_fd, e, (unsigned) strlen(e)) != (int) strlen(e)) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
-				}
+				e += 3;
+				if(write(write_fd, e, (unsigned) strlen(e)) != (int) strlen(e)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
+				}
 			} else {
 				ml++;
 			}
@@ -1031,11 +1031,11 @@ static int preprocess(const char *file, int write_fd, int rlevel)
 
 			continue;
 		}
-
-		if(write(write_fd, bp, (unsigned) cur) != (int) cur) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
-		}
-
+
+		if(write(write_fd, bp, (unsigned) cur) != (int) cur) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
+		}
+
 	}
 
 	close(read_fd);