Fixed a round of warnings produced by cppcheck 1.52