Be careful in converting ids to defs.

If we encounter a missing def, log a warning and omit it.