Fixed several build system issues.