Fixed several build errors