fixed compile bugs which where detected by clang++ but not gcc