fix problems found by cppcheck