fixed bugs in bootstrap.sh & streamlined code