Made run.sh script a little more robust