Correct some typos and cppcheck style warnings