factored out some utility functions to util.sh
fixed bundle path bug