fixed errors reported by cppcheck

... or added comments where I was too lazy for fixing