Fixed some code code validity reported by Cppcheck