Fixed a build error and several warnings.