diff --git a/build.sh b/build.sh
index bf6365ff7cdd91329473e185c90e621617076c59..42dc7b0b636dcbb2ccf78f71a01c2620fb4d7b3e 100755
--- a/build.sh
+++ b/build.sh
@@ -8,13 +8,16 @@ target=$3
 comp_type=$4
 branch=$5
 
+if [ x"$branch" == x"" ]; then
+  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
+fi
+
 echo "Directory: $workspace"
 echo "Machine: $hostname"
 echo "make target: $target"
 echo "compilation type: $comp_type"
 echo "Branch name: $branch"
 
-rm -rf $HOME/openfpm_dependencies/openfpm_pdata/0
 
 if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de"  ]; then
 	./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4
@@ -32,11 +35,6 @@ if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de"  ]; then
         echo 4 > $HOME/openfpm_dependencies/openfpm_io/$branch/MPI/version
 fi
 
-
-if [ x"$branch" == x"" ]; then
-  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
-fi
-
 #### If you have a dep_dir file change the branch name to the dep_dir
 
 dep_dir=$(cat dep_dir)
diff --git a/run.sh b/run.sh
index 1bbb15d974cd93fb38c43e7d28982d7e6a8c8b23..9f1c3bd12ef44aba0a3c1200e712477ce2d927da 100755
--- a/run.sh
+++ b/run.sh
@@ -3,12 +3,16 @@
 # Make a directory in /tmp/OpenFPM_pdata
 
 workspace=$1
-hostname=$2
+hostname=$(hostname)
 nproc=$3
 ntask_per_node=$5
 nodes=$4
 branch=$6
 
+if [ x"$branch" == x"" ]; then
+  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
+fi
+
 echo "Directory: workspace"
 echo "Machine: $hostname"
 echo "Num of processors: $nproc"