Fix copyright.
Fix a few bugs, switch to lazy init of core.