Applied some cppcheck suggestions