Add additional error checking to build script