Script fixes + build patch