fix handling of missing documents