Fixed the code to remove some compile warnings.