cppcheck and gcc compilation fixes