Fixed bugs causing primary build errors