diff --git a/bin/unlock.js b/bin/unlock.js
index 26809293734731598cb71fa537c13523f2184427..bcd3b8984971614e3a8776eabfcf1b75fbaed61b 100755
--- a/bin/unlock.js
+++ b/bin/unlock.js
@@ -60,8 +60,12 @@ function unlockall()
 {
     var     wallets             =   new Array();
     web3.bfa.personal.listWallets(
-        function pushone(x)
+        function pushone(err,x)
         {
+            if ( err )
+                bye( 1, err );
+            if ( x == undefed )
+                bye( 1, "wallets not defined" );
             var     failures    =   0;
             var     promises    =   new Array();
             var     i           =   x.length;