diff --git a/oaienv b/oaienv
index c977a1a8c2c78d7aa25ea1816901252d71cb0bef..f71ea24826dcbbc9b2d21a9c822337ad66d1a577 100644
--- a/oaienv
+++ b/oaienv
@@ -4,6 +4,7 @@ export OPENAIR1_DIR=$OPENAIR_HOME/openair1
 export OPENAIR2_DIR=$OPENAIR_HOME/openair2
 export OPENAIR3_DIR=$OPENAIR_HOME/openair3
 export OPENAIR_TARGETS=$OPENAIR_HOME/targets
+export OPENAIRCN_DIR=$OPENAIR_HOME/openair-cn
 
 alias  oai='cd $OPENAIR_HOME'
 alias oai0='cd $OPENAIR0_DIR'
@@ -14,3 +15,4 @@ alias oait='cd $OPENAIR_TARGETS'
 alias oaiu='cd $OPENAIR2_DIR/UTIL'
 alias oais='cd $OPENAIR_TARGETS/SIMU/USER'
 alias oaiex='cd $OPENAIR_TARGETS/SIMU/EXAMPLES'
+alias oaicn='cd OPENAIRCN_DIR'
diff --git a/targets/build_helper.bash b/targets/build_helper.bash
index cac84bab06e0705840ecfd9569433cc29124bae6..cb21f6fdd6ee813746994670d62f41761e7bf71a 100755
--- a/targets/build_helper.bash
+++ b/targets/build_helper.bash
@@ -54,7 +54,7 @@ check_for_root_rights() {
     
   #  if [[ $EUID -ne $ROOT_EUID ]]; then
     if [ $USER != "root" ]; then
-       	SUDO="sudo -S -E "
+       	SUDO="sudo -E "
 	echo "Run as a sudoers" 
 	return 1
     else 
@@ -145,6 +145,7 @@ make_certs(){
     
     echo "Copying cakey.pem user.key.pem cacert.pem to /usr/local/etc/freeDiameter/"
     $SUDO cp user.key.pem user.cert.pem cacert.pem /usr/local/etc/freeDiameter/
+    mv user.key.pem user.cert.pem cacert.pem bin/
     
 # openssl genrsa -out ubuntu.key.pem 1024
 # openssl req -new -batch -x509 -out ubuntu.csr.pem -key ubuntu.key.pem -subj /CN=ubuntu.localdomain/C=FR/ST=BdR/L=Aix/O=fD/OU=Tests
@@ -269,7 +270,7 @@ check_s6a_certificate() {
 check_install_oai_software() {
     
     if [ ! -f ./.lock_oaibuild ]; then 
-
+	$SUDO apt-get update
 	test_install_package autoconf 
 	test_install_package automake 
 	test_install_package bison 
@@ -370,7 +371,7 @@ check_install_oai_software() {
         check_s6a_certificate
     fi
 
-    test_command_install_script   "asn1c" "$OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $result"
+    test_command_install_script   "asn1c" "$OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $SUDO"
     
     # One mor check about version of asn1c
     ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE="ASN.1 Compiler, v0.9.24"
@@ -382,7 +383,7 @@ check_install_oai_software() {
         echo_error "$ASN1C_COMPILER_VERSION_MESSAGE"
         while read -r -n 1 -s answer; do
             if [[ $answer = [YyNn] ]]; then
-                [[ $answer = [Yy] ]] && $OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $results
+                [[ $answer = [Yy] ]] && $OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $SUDO
                 [[ $answer = [Nn] ]] && echo_error "Version of asn1c is not the required one, exiting." && exit 1
                 break
             fi
@@ -721,6 +722,25 @@ install_oaisim() {
    
 }
 
+################################
+# set_openair
+###############################
+set_openair_env(){
+
+    index=`pwd | grep -b -o targets | cut -d: -f1`
+    if [ $index = "" ] || [ $index= " " ] ; then
+	echo_error "Please run the script from targets directory or any child directories"
+    else 
+	oai_path=`pwd | cut -c1-$index`
+	export OPENAIR_HOME=$oai_path
+	export OPENAIR1_DIR=$oai_path/openair1
+	export OPENAIR2_DIR=$oai_path/openair2
+	export OPENAIR3_DIR=$oai_path/openair3
+	export OPENAIR_TARGETS=$oai_path/targets
+	export OPENAIRCN_DIR=$oai_path/openair-cn
+    fi
+
+}
 ###############################
 ## echo and  family 
 ###############################
diff --git a/targets/build_oai.bash b/targets/build_oai.bash
index f92033f6032ab6526336d58521413f93a524b986..6e3ddc057459549c91d4f482ada7fbbf84c75519 100755
--- a/targets/build_oai.bash
+++ b/targets/build_oai.bash
@@ -164,18 +164,18 @@ touch bin/${oai_build_date}
 ################################
 # cleanup first 
 ################################
-echo_info "3. Cleaning ..."
+#echo_info "3. Cleaning ..."
 
-$SUDO kill -9 `ps -ef | grep oaisim | awk '{print $2}'`
-$SUDO kill -9 `ps -ef | grep lte-softmodem | awk '{print $2}'`
-$SUDO kill -9 `ps -ef | grep dlsim | awk '{print $2}'`
-$SUDO kill -9 `ps -ef | grep ulsim | awk '{print $2}'`
+#$SUDO kill -9 `ps -ef | grep oaisim | awk '{print $2}'` 2>&1
+#$SUDO kill -9 `ps -ef | grep lte-softmodem | awk '{print $2}'`  2>&1
+#$SUDO kill -9 `ps -ef | grep dlsim | awk '{print $2}'`  2>&1
+#$SUDO kill -9 `ps -ef | grep ulsim | awk '{print $2}'`  2>&1
 
 ##########################################
 # process parameters
 #########################################
 
-echo_info "3. Process the parameters"
+echo_info "2. Process the parameters"
 
 echo_info "User-defined Parameters :  HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG XFORMS=$XFORMS"
 echo_info "ENB_CONFIG_FILE: $ENB_CONFIG_FILE"
@@ -188,7 +188,7 @@ echo "ENB_CONFIG_FILE: $ENB_CONFIG_FILE" >>  bin/${oai_build_date}
 # compilation directives 
 ############################################
 
-echo_info "4. building the compilation directives ..."
+echo_info "3. building the compilation directives ..."
 
 SOFTMODEM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS "
 OAISIM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS "
@@ -240,11 +240,13 @@ echo "SOFTMODEM Compilation directives: $SOFTMODEM_DIRECTIVES" >>  bin/${oai_bui
 echo "OAISIM Compilation directive:    $OAISIM_DIRECTIVES" >>  bin/${oai_build_date}
 
 ############################################
-# Printing OAI envs, we should check here
+# setting and printing OAI envs, we should check here
 ############################################
 
+echo_info "3. Setting the OAI PATHS ..."
+
+output=$(set_openair_env 2>&1) 
 
-echo_info "5. Checking the OAI PATHS ... (TBD)"
 cecho "OPENAIR_HOME    = $OPENAIR_HOME" $green
 cecho "OPENAIR1_DIR    = $OPENAIR1_DIR" $green
 cecho "OPENAIR2_DIR    = $OPENAIR2_DIR" $green
@@ -365,8 +367,4 @@ if [ $OAI_TEST = 1 ]; then
 else 
     echo_info "9. Bypassing the Tests ..."
 fi 
- 
-
-
-
-
+ 
\ No newline at end of file