Fixed non-compiling tests, a few build script bugs, and some error reporting in Main