fixed cppcheck errors