Fixed some problems reported by cppcheck.