Index: trunk/Nebulous/nebclient/src/nebclient.c
===================================================================
--- trunk/Nebulous/nebclient/src/nebclient.c	(revision 24931)
+++ trunk/Nebulous/nebclient/src/nebclient.c	(revision 24939)
@@ -833,9 +833,22 @@
 }
 
+void nebObjectStatFree(nebObjectStat *stat)
+{
+    if (!stat) {
+        return;
+    }
+
+    xfree(stat->so_id);
+    xfree(stat->ext_id);
+    xfree(stat->read_lock);
+    xfree(stat->write_lock);
+    xfree(stat->epoch);
+    xfree(stat->mtime);
+    xfree(stat);
+}
+
 
 int nebChmod(nebServer *server, const char *key, mode_t mode)
 {
-    int response;
-
     REQUIRE_SERVER;
 
@@ -849,4 +862,5 @@
     // manual seems to 'suggest' that this is temporary data that gets cleaed
     // up on the next soap function call
+    int response;
     if (soap_call_ns1__chmod_USCOREobject(server->soap, server->endpoint,
             NULL, (char *)key, mode, &response) != SOAP_OK) {
@@ -861,6 +875,4 @@
 int nebPrune(nebServer *server, const char *key)
 {
-    int response;
-
     REQUIRE_SERVER;
 
@@ -874,4 +886,5 @@
     // manual seems to 'suggest' that this is temporary data that gets cleaed
     // up on the next soap function call
+    int response;
     if (soap_call_ns1__prune_USCOREobject(server->soap, server->endpoint,
             NULL, (char *)key, &response) != SOAP_OK) {
@@ -893,7 +906,12 @@
     }
 
+    // first - strip off any inaccesible instances
     if (nebPrune(server, key) < 0 ) {
-    }
-
+        // use the prune() method to also determine if $key is valid
+        return -1;
+    }
+
+    // check to see if there is an instance on $vol_name that should be the
+    // sole survivor
     nebObjectInstances *locations = NULL;
     if (volume) {
@@ -901,17 +919,39 @@
     }
 
+    long removed = 0;
     if (locations && locations->n) {
         nebObjectInstances *instances = nebFindInstances(server, key, NULL);
         for (long i = 0; i < instances->n; i++) {
-            if (strcmp(locations->URI[0], instances->URI[i])) {
-                nebDeleteInstance(server, key, instances->URI[i]);
+            if (strcmp(locations->URI[0], instances->URI[i]) == 0) {
+                continue;
             }
+            if (!nebDeleteInstance(server, key, instances->URI[i])) {
+                nebObjectInstancesFree(instances);
+                nebObjectInstancesFree(locations);
+                return -1;
+            }
+            removed++;
         }
         nebObjectInstancesFree(instances);
-    }
-    nebObjectInstancesFree(locations);
-
-
-    return 0;
+        nebObjectInstancesFree(locations);
+    } else {
+        // nuke whatever
+        nebObjectStat *stat = nebStat(server, key);
+        if (!stat) {
+            return -1;
+        }
+        // start at one so cull() is called one less time then the # of
+        // instances
+        for (long i = 1; i < stat->available; i++) {
+            if (!nebCull(server, key)) {
+                nebObjectStatFree(stat);
+                return -1;
+            }
+            removed++;
+        }
+        nebObjectStatFree(stat);
+    }
+
+    return removed;
 }
 
