diff --git a/src/freedombone-pass b/src/freedombone-pass
index 4b2cc1d6fdb5299ebf9eb571d720cec03fa2ce39..d2e6ae70cee212ced8ff984229e4e09e818b133f 100755
--- a/src/freedombone-pass
+++ b/src/freedombone-pass
@@ -277,18 +277,6 @@ if [ ! -d /home/$CURR_USERNAME ]; then
     fi
 fi
 
-if [[ "$CURR_USERNAME" == "root" ]]; then
-    if [ ! -d /root/.passwords/root ]; then
-        mkdir -p /root/.passwords/root
-    fi
-    if [ ! -f /root/.passwords/root/master ]; then
-        MASTER_PASSWORD=$(openssl rand -base64 32 | cut -c1-30)
-        echo "$MASTER_PASSWORD" > /root/.passwords/root/master
-        chmod 700 /root/.passwords/root/master
-    fi
-    MASTER_PASSWORD=$(cat /root/.passwords/root/master)
-fi
-
 if [ ${REMOVE_APP} ]; then
     if [ -d ~/.passwords/${CURR_USERNAME}/${REMOVE_APP} ]; then
         shred -zu ~/.passwords/${CURR_USERNAME}/${REMOVE_APP}
@@ -301,9 +289,21 @@ if [ ! $CURR_APP ]; then
     exit 3
 fi
 
+if [[ "$CURR_USERNAME" == "root" ]]; then
+    if [ ! -d /root/.passwords/root ]; then
+        mkdir -p /root/.passwords/root
+    fi
+    if [ ! -f /root/.passwords/root/master ]; then
+        echo "$(openssl rand -base64 32 | cut -c1-30)" > /root/.passwords/root/master
+        chmod 700 /root/.passwords/root/master
+    fi
+    MASTER_PASSWORD=$(cat /root/.passwords/root/master)
+fi
+
 if [ ${#CURR_PASSWORD} -eq 0 ]; then
     # retrieve password
     if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
+        MASTER_PASSWORD=
         echo ""
         exit 4
     else
@@ -314,6 +314,7 @@ else
     # store password
     if [ -f $NO_PASSWORD_STORE_FILE ]; then
         if [[ "$CURR_USERNAME" != 'root' ]]; then
+            MASTER_PASSWORD=
             exit 0
         fi
     fi
@@ -323,8 +324,10 @@ else
     # padding helps to ensure than nothing can be learned from the length of the cyphertext
     pad_string "${CURR_PASSWORD}" | gpg -ca --cipher-algo AES256 --passphrase "$MASTER_PASSWORD" > ~/.passwords/$CURR_USERNAME/$CURR_APP
     if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
+        MASTER_PASSWORD=
         exit 5
     fi
 fi
 
+MASTER_PASSWORD=
 exit 0