fixed gcc/clang compile warnings and errors