use doc instead of target_document