some fixes from cppcheck analysis