Fix some compile errors and warnings.