Fixed errors and warnings when compiling with gcc instead of clang