fix infinite loop in build script