Fix lots of compile bugs.
Fix remaining compile blockers in the main codebase