diff --git a/test/bootstrap_test_db.sh b/test/bootstrap_test_db.sh
index 1a922d7d431932ba593322467a7db9ed9c6a29ab..07395f11f3811dd8310c6071434dd01806b450be 100755
--- a/test/bootstrap_test_db.sh
+++ b/test/bootstrap_test_db.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/usr/bin/env bash
+set -e
 
 if [ -z "$1" ]
   then
@@ -6,4 +7,10 @@ if [ -z "$1" ]
     exit 1
 fi
 
-../../../live.sh cmd PYTHONPATH=code/api:code/data code/api/bin/bootstrap.py users -f mongodb://localhost:9001/scitran code/api/test/test_bootstrap.json $1
\ No newline at end of file
+(
+	# Set cwd
+	unset CDPATH
+	cd "$( dirname "${BASH_SOURCE[0]}" )"
+
+	../../../live.sh cmd PYTHONPATH=code/api:code/data code/api/bin/bootstrap.py users -f mongodb://localhost:9001/scitran code/api/test/test_bootstrap.json $1
+)
diff --git a/test/runtests.sh b/test/runtests.sh
index cc5f0829cd251f41ab6bd8e02960bb83f0d81228..b289b1e561460cf92e2ae4ecb341a820b57a6f9d 100755
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -1,3 +1,10 @@
-#!/bin/sh
+#!/usr/bin/env bash
+set -e
 
-../../../live.sh cmd PYTHONPATH=code/api:code/data nosetests -vv --exe --collect-only code/api/test/$1
\ No newline at end of file
+(
+	# Set cwd
+	unset CDPATH
+	cd "$( dirname "${BASH_SOURCE[0]}" )"
+
+	../../../live.sh cmd PYTHONPATH=code/api:code/data nosetests -vv --exe --collect-only code/api/test/$1
+)