Fixed some error messages and compile warnings