Changes to fix cppcheck issues