Use new interface for SetBestChain. Fix a few more compilation issues.