Better dependency checking in build.sh