fixing another undefined behaviour (missing virtual destructor)