fix some errors/warnings found by static code analyzer
Merge pull request #429 from abma/master

fix some errors/warnings found by static code analyzer