diff --git a/powerproc.cpp b/powerproc.cpp
index b43eb80f6383228dc457954e13c6d3f73ddd0895..2001d75c264f48686168d02519610ea2260ab4f1 100644
--- a/powerproc.cpp
+++ b/powerproc.cpp
@@ -42,12 +42,12 @@ String PowerProcedure::toJSON() {
             json += mpod.toJSON();
             json += ",\n";
         }
-        json.remove(json.length() - 2, 1);  // Remove trailing comma of last entry
+        json.remove(json.lastIndexOf(','), 1);  // Remove trailing comma of last entry
 
         json += "]\n";
         json += "},\n";
     }
-    json.remove(json.length() - 2, 1);  // Remove trailing comma of last entry
+    json.remove(json.lastIndexOf(','), 1);  // Remove trailing comma of last entry
 
     json += "]\n";  // groups body
     json += "}";    // json body
diff --git a/rest.cpp b/rest.cpp
index 384d135f7ac908947e9e35afc940093886f8cf0e..3991f0cb4720c1941ec7401d0d57f5dcf8e8f1aa 100644
--- a/rest.cpp
+++ b/rest.cpp
@@ -84,7 +84,7 @@ void identify() {
 
     message += "\n}";
 
-    restServer.send(200, "text/json", message);
+    restServer.send(418, "text/json", message);
 }
 
 void panel() {
@@ -162,7 +162,7 @@ void sendSNMP() {
 
     http_msg += "\n}";
 
-    restServer.send(200, "text/json", http_msg);
+    restServer.send(success ? 200 : 406, "text/json", http_msg);
 }
 
 void powerGroup() {
@@ -190,18 +190,17 @@ void powerGroup() {
     }
 
     String http_msg = "{\n";
-    http_msg += "\"target\":\"" + pproc.ipAddr.toString() + "\",\n";
     http_msg += "\"arguments\":{";
     http_msg += "\"group\":\"" + group + "\",";
     http_msg += "\"output\":\"" + output + "\"},\n";
-    http_msg += "\"success\":" + String(success) + ",\n";
+    http_msg += "\"success\":" + String(success);
     if (success) {
-        http_msg += "\"status\":\n";
+        http_msg += ",\n\"status\":\n";
         http_msg += pproc.toJSON();
     }
     http_msg += "\n}";
 
-    restServer.send(200, "text/json", http_msg);
+    restServer.send(success ? 200 : 406, "text/json", http_msg);
 }
 
 void pollMPODChannel() {
@@ -236,5 +235,5 @@ void pollMPODChannel() {
     http_msg += channel;
     http_msg += "\n}";
 
-    restServer.send(200, "text/json", http_msg);
+    restServer.send(channel ? 200 : 406, "text/json", http_msg);
 }