some fixes from cppcheck analysis
Merge pull request #1523 from AntonioBL/cppcheck

some fixes from cppcheck analysis