Update building script
Fix compile errors