diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 87b70877bef74ee6fe95ae23f810542c99757887..71177e40f91302cb3a7d249ef06d264ae39b530e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -31,3 +31,4 @@ update_repo:
   only:
     - tags
 
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 84baf9d1396f62c8e7b77b1a6c4ee5ed04e7ca52..225761cc277f4467c6bc3ea308434d36491e85bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,7 +102,7 @@ IF (UNIX)
   SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu")
 
 # Uncomment to add the necessary mantainer scripts
-#   SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/package_scripts/preinst;${CMAKE_SOURCE_DIR}/package_scripts/postinst;${CMAKE_SOURCE_DIR}/package_scripts/prerm;${CMAKE_SOURCE_DIR}/package_scripts/postrm")
+  SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/postinst;${CMAKE_SOURCE_DIR}/scripts/debian/prerm")
 
 # Uncomment to add dependencies comma separated
 # SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-<package_name>-dev (>= 1.0~${DISTRIB})")
diff --git a/ReadMe.md b/ReadMe.md
index ae4382e8284e7bbcbe66522e829b45d6dbbcd1a6..074e0d770a0900f4f88421795295a7f2c0c560eb 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -84,6 +84,26 @@ Run the commands on _add repository_ and _add key_ from [labrobotica_how_to inst
 
 ``` sudo apt update && sudo apt install iri-iriutils-dev ```
 
+## Scripts
+
+The following scripts located in `./scripts/` are provided:
+
+* **add_lib_to_ld_config.sh**: To add the library path to ldconfig
+  - Usage:
+
+        ./add_lib_to_ld_config.sh -l <library> [-p]
+          -l  specify library name, for example iriutils"
+          -p  specify if installed from package. Optional."
+
+* **remove_lib_from_ld_config.sh**: To remove the library path from ldconfig
+  - Usage:
+
+        ./remove_lib_from_ld_config.sh -l <library> [-p]
+          -l  specify library name, for example iriutils"
+          -p  specify if installed from package. Optional."
+
+These scripts will be added to the PATH variable after installation.
+
 ## Disclaimer  
 
 Copyright (C) 2009-2018 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
diff --git a/scripts/add_lib_to_ld_config.sh b/scripts/add_lib_to_ld_config.sh
new file mode 100755
index 0000000000000000000000000000000000000000..280b3949e6c77589358f5cc6991720d22f2f3e94
--- /dev/null
+++ b/scripts/add_lib_to_ld_config.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+set -e
+
+FILE="/etc/ld.so.conf.d/iri.conf"
+LIB=
+LOCAL="local/"
+
+usage() {
+  echo "Usage: $0 -l <library> [-p]"
+  echo " -l  specify library name"
+  echo " -p  specify if installed from package. Optional."
+  exit 1
+  }
+
+while getopts ":hl:p" arg; do
+  case $arg in
+    l) LIB=$OPTARG;;
+    p) LOCAL="";;
+    h) usage;;
+    *) usage;;
+  esac
+done
+
+if [ -z "$LIB" ]
+then
+  echo "Error: no library specified"
+  usage
+fi
+
+sudo touch $FILE
+LINE="/usr/${LOCAL}lib/iri/${LIB}"
+echo "Adding ${LINE} to ${FILE}..."
+grep -qF -- "$LINE" "$FILE" || echo "$LINE" | sudo tee -a "$FILE" > /dev/null
+
+sudo ldconfig
+
+echo "Done."
diff --git a/scripts/debian/postinst b/scripts/debian/postinst
new file mode 100755
index 0000000000000000000000000000000000000000..bc45b96f765aecd8c13d81d8d1e89ae52c71cb0b
--- /dev/null
+++ b/scripts/debian/postinst
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -e
+
+case "$1" in
+  configure)
+
+    echo "  Adding iri-scripts-path.sh to /etc/profile.d..."
+    FILE="/etc/profile.d/iri-scripts-path.sh"
+    sudo echo "# Expand PATH to include the directory where IRI scripts go." > $FILE
+    sudo echo "iri_script_path=\"/usr/local/share/iri:/usr/share/iri\"" >> $FILE
+    sudo echo "if [ -n \"\${PATH##*\${iri_script_path}}\" -a -n \"\${PATH##*\${iri_script_path}:*}\" ]; then" >> $FILE
+    sudo echo "    export PATH=\$PATH:\${iri_script_path}" >> $FILE
+    sudo echo "fi" >> $FILE
+    echo "  Done. It's necessary a log out for changes to take effect."
+
+    echo "   Trying to add library to ldconfig..."
+    /usr/share/iri/add_lib_to_ld_config.sh -l iriutils -p && echo "   Done." || echo "   /usr/share/iri/add_lib_to_ld_config.sh doesn't exists. Download it from iriutils and execute it."
+    
+  ;;
+  abort-upgrade)
+
+  ;;
+  abort-remove)
+
+  ;;
+  abort-deconfigure)
+
+  ;;
+esac   
+
+exit 0
diff --git a/scripts/debian/prerm b/scripts/debian/prerm
new file mode 100644
index 0000000000000000000000000000000000000000..e1d5ab76092ee339636085b04a85e196c50a6738
--- /dev/null
+++ b/scripts/debian/prerm
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -e
+
+case "$1" in
+  remove)
+    echo "   Trying to remove library from ldconfig..."
+    /usr/share/iri/remove_lib_from_ld_config.sh -l iriutils -p && echo "   Done." || echo "   /usr/share/iri/remove_lib_from_ld_config.sh doesn't exists. Download it from iriutils and execute it."
+
+  ;;
+  upgrade)
+
+  ;;
+  deconfigure)
+
+  ;;
+  failed-upgrade)
+
+  ;;
+esac    
+
+exit 0
diff --git a/scripts/remove_lib_from_ld_config.sh b/scripts/remove_lib_from_ld_config.sh
new file mode 100755
index 0000000000000000000000000000000000000000..23a30cd98133f3b5a18e08ca4e6caf08854d6804
--- /dev/null
+++ b/scripts/remove_lib_from_ld_config.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+set -e
+
+FILE="/etc/ld.so.conf.d/iri.conf"
+LIB=
+LOCAL="local\/"
+
+usage() {
+  echo "Usage: $0 -l <library> [-p]"
+  echo " -l  specify library name"
+  echo " -p  specify if installed from package. Optional."
+  exit 1
+  }
+
+while getopts ":hl:p" arg; do
+  case $arg in
+    l) LIB=$OPTARG;;
+    p) LOCAL="";;
+    h) usage;;
+    *) usage;;
+  esac
+done
+
+if [ -z "$LIB" ]
+then
+  echo "Error: no library specified"
+  usage
+fi
+
+sudo touch $FILE
+echo "Removing /usr/${LOCAL}lib/iri/${LIB} from ${FILE}..."
+LINE="\/usr\/${LOCAL}lib\/iri\/${LIB}"
+sudo sed -i "/$LINE/d" $FILE
+
+
+sudo ldconfig
+
+echo "Done."
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 014393509d850680e52fee6a6f109eb8924e1e1e..9dbcf76d87a86f697fdf29aa8662f77998b75705 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,4 +28,10 @@ INSTALL(FILES ${headers} DESTINATION include/iri/${PROJECT_NAME})
 
 INSTALL(FILES ../Findiriutils.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
 
+INSTALL(FILES  ../scripts/add_lib_to_ld_config.sh 
+               ../scripts/remove_lib_from_ld_config.sh 
+               DESTINATION share/iri
+               PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE)
+
+
 ADD_SUBDIRECTORY(examples)
diff --git a/src/mutex/mutex.cpp b/src/mutex/mutex.cpp
index f4dbee4d07306f4895b747a0d6946f7a4e4ee5d3..e49f1f76eeea85d7351814f140112774c003e517 100644
--- a/src/mutex/mutex.cpp
+++ b/src/mutex/mutex.cpp
@@ -74,13 +74,7 @@ void CMutex::exit(void)
 
 CMutex::~CMutex()
 {
-  int error=0;
-
   this->try_enter();
   this->exit();
-  if((error=pthread_mutex_destroy(&this->access))!=0)
-  {
-    /* handle exception */
-    throw CMutexException(_HERE_,"Impossible to destroy the mutex.\n");
-  }
+  pthread_mutex_destroy(&this->access);
 }