Few minor issues highlighted by cppcheck/valgrind.