diff --git a/ps-config/install_pocketsphinx_conf.sh b/ps-config/install_pocketsphinx_conf.sh
index 749fc98011b2229b068f02a14a36c496d2429c79..3bf24d11ea966a8825b5f55af70198d6279defc1 100755
--- a/ps-config/install_pocketsphinx_conf.sh
+++ b/ps-config/install_pocketsphinx_conf.sh
@@ -1,14 +1,21 @@
 #!/bin/sh
-if [ $1 ]
- then installdir=$1
- else installdir="/vol/robocup/2013/share/SpeechRec/"
+
+set -e
+
+BASEDIR=$(dirname $(readlink -f $0))
+cd ${BASEDIR}
+
+if [ ! -n "$prefix" ]; then
+        echo "Environment variable \"\$prefix\" must be set!"
+        exit 1
 fi
-mkdir -p $installdir/psConfig
+
+mkdir -p ${prefix}/share/SpeechRec/psConfig
 
 for i in `ls` 
 do
   if [ -d $i ]
-    then cp -r $i $installdir/psConfig
+    then cp -r $i ${prefix}/share/SpeechRec/psConfig
   fi
 done
 
diff --git a/ps-grammar/install_pocketsphinx.sh b/ps-grammar/install_pocketsphinx.sh
index 0482d391e8ef16cfbbf1c5b509d717d01b6b5ccd..767f361b7dbe4854b350ab7d23fc76fcf94f35d5 100755
--- a/ps-grammar/install_pocketsphinx.sh
+++ b/ps-grammar/install_pocketsphinx.sh
@@ -1,14 +1,20 @@
 #!/bin/sh
-if [ $1 ]
- then installdir=$1
- else installdir="/vol/robocup/2013/share/SpeechRec/"
+set -e
+
+BASEDIR=$(dirname $(readlink -f $0))
+cd ${BASEDIR}
+
+if [ ! -n "$prefix" ]; then
+        echo "Environment variable \"\$prefix\" must be set!"
+        exit 1
 fi
-mkdir -p $installdir/psGrammar
+
+mkdir -p ${prefix}/share/SpeechRec/psConfig
 
 for i in `ls` 
 do
   if [ -d $i ]
-    then cp -r $i $installdir/psGrammar
+    then cp -r $i ${prefix}/share/SpeechRec/psConfig
   fi
 done