Changes suggested by cppcheck, plus some missing virtual destructors