check d->type before access d->type->dfree