fixed compile warnings and errors