fixed some warnings from cppcheck. Commit only to check whether everything is ok