updated build.sh to include proper exit code