Made build.sh a bit more rescilient