Fix a bunch of compilation issues.
merge conflict