cppcheck: fix multiple warnings