Fix compilations errors.
And add ObjectMgr class.