Fixed inspired by clang-tidy
Fixes several problem discovered by running the default check of clang-tidy (and add a comment where clang-tidy is incorrect).
Fixes several problem discovered by running the default check of clang-tidy (and add a comment where clang-tidy is incorrect).