fixing cppcheck errors