Build.sh: multibranch support && some fixes