Fix compile warnings and errors.