Fix shellcheck warnings
diff --git a/functions/common.sh b/functions/common.sh
index 9d0d956..29b3285 100644
--- a/functions/common.sh
+++ b/functions/common.sh
@@ -3,7 +3,7 @@
 cleanup_and_exit()
 {
     trap EXIT
-    exit ${1:-0}
+    exit "${1:-0}"
 }
 
 fail_exit()
@@ -20,19 +20,20 @@
     eval "exec $fd>>$LOCKFILE"
     case $1 in
         "set")
-            flock -x -n $fd \
+            flock -x -n "$fd" \
                 || fail_exit "Process already running. Lockfile: $LOCKFILE"
             ;;
         "unset")
-            flock -u $fd
-            rm -f $LOCKFILE
+            flock -u "$fd"
+            [ -f "$LOCKFILE" ] && rm -f "$LOCKFILE"
             ;;
         "wait")
             local TIMEOUT=${2:-3600}
-            [ "${VERBOSE}" == "true" ] \
-                && echo "Waiting of concurrent process (lockfile: $LOCKFILE, timeout = $TIMEOUT seconds) ..."
-            flock -x -w $TIMEOUT $fd \
+            [ "$IS_VERBOSE" == "true" ] \
+                && echo "[INFO] Waiting of concurrent process (lockfile: $LOCKFILE, timeout = $TIMEOUT seconds) ..."
+            flock -x -w "$TIMEOUT" "$fd" \
                 || fail_exit "Timeout error (lockfile: $LOCKFILE)"
+            [ "${IS_VERBOSE}" == "true" ] && echo "[INFO] Done"
             ;;
     esac
 }
diff --git a/functions/rsync.sh b/functions/rsync.sh
index eabdf20..b221f47 100644
--- a/functions/rsync.sh
+++ b/functions/rsync.sh
@@ -94,6 +94,7 @@
 rsync_create_dir() {
     local RSYNCPATH=$1
     if ! rsync_list_dirs "${RSYNCPATH%/*}" &>/dev/null ; then
+        [ "${RSYNCPATH%/*}" == "${RSYNCPATH}" ] && fail_exit "[FAIL] Can't reach to the rsync root"
         rsync_create_dir "${RSYNCPATH%/*}"
     fi
     if ! rsync_list_dirs "${RSYNCPATH}" &>/dev/null ; then
@@ -162,7 +163,8 @@
     [ -z "$FOLDERNAME" ] && FOLDERNAME=${SRCDIR##*/}
 
     # Lock source dir to prevent concurent sync stage
-    job_lock ${SRCDIR}.lock wait
+    local LOCK_FILE=${SRCDIR}.lock
+    job_lock "$LOCK_FILE" wait
     rsync_list_dirs "${RSYNCPATH}/$FILESDIR" &>/dev/null \
         || rsync_create_dir "${RSYNCPATH}/$FILESDIR"
 
@@ -211,7 +213,7 @@
     fi
 
     # Unlock source dir
-    job_lock ${SRCDIR}.lock unset
+    job_lock "$LOCK_FILE" unset
 
     return $RESULT
 }
diff --git a/trsync.sh b/trsync.sh
index 8f4aa35..23b8a7d 100755
--- a/trsync.sh
+++ b/trsync.sh
@@ -7,3 +7,4 @@
 source "${BIN_DIR}/functions/rsync.sh"
 
 rsync_transfer "$1" "$2"
+cleanup_and_exit 0