Fixed a bunch of compile problems, API changes, and deprecation
warnings.