diff --git a/lib/agent/actions/lock/index.js b/lib/agent/actions/lock/index.js
index <HASH>..<HASH> 100644
--- a/lib/agent/actions/lock/index.js
+++ b/lib/agent/actions/lock/index.js
@@ -78,7 +78,7 @@ function open(password, cb) {
     child = lock;
 
     child.stdout.on('data', function(data) {
-      if (child.impersonating && data.toString().match(/PID:? (\d+)/)) {
+      if (child && child.impersonating && data.toString().match(/PID:? (\d+)/)) {
         child.impersonated_pid = data.toString().match(/PID:? (\d+)/)[1];
 
       } else if (emitter && data.toString().match(/invalid password/i)) {
diff --git a/lib/system/index.js b/lib/system/index.js
index <HASH>..<HASH> 100644
--- a/lib/system/index.js
+++ b/lib/system/index.js
@@ -107,6 +107,8 @@ var as_logged_user = function(type, bin, args, opts, cb) {
   if (typeof opts == 'function') {
     var cb   = opts;
     var opts = {};
+  } else if (!opts) {
+    var opts = {};
   }
 
   system.get_logged_user(function(err, user) {
Two small validations in lock and system libs.