Fix after static analyzing

I used CppCheck for improving quality of the code