Fix type retrieval when doc is present.