Fixing a few errors found with CppCheck