diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/phosphonetx/ResultDataSetUploader.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/phosphonetx/ResultDataSetUploader.java
index 1aa3b88d088acafe8227d4bd6ffd9c41beffa6d4..a4e8829e7f4470f89797b8022ac2699916f2cc7c 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/phosphonetx/ResultDataSetUploader.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/phosphonetx/ResultDataSetUploader.java
@@ -79,13 +79,19 @@ class ResultDataSetUploader extends AbstractHandler
     {
         try
         {
-            Experiment experiment = getOrCreateExperiment(dataSetInfo.getExperiment().getPermId());
-            Sample sample = getOrCreateSample(experiment, dataSetInfo.getSample().getPermId());
+            Experiment experiment = getOrCreateExperiment(dataSetInfo.tryToGetExperiment().getPermId());
+            ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample dataSetInfoSample =
+                    dataSetInfo.tryToGetSample();
+            if (dataSetInfoSample == null)
+            {
+                throw new UserFailureException("Missing sample in " + dataSetInfo);
+            }
+            Sample sample = getOrCreateSample(experiment, dataSetInfoSample.getPermId());
             String referenceDatabase = summary.getSummaryHeader().getReferenceDatabase();
             Database database = getOrGreateDatabase(referenceDatabase);
             DataSet ds =
                     getOrCreateDataSet(experiment, sample, database, dataSetInfo.getDataSetCode());
-            addToDatabase(ds, experiment, dataSetInfo.getSample().getGroup(), summary);
+            addToDatabase(ds, experiment, dataSetInfoSample.getGroup(), summary);
             if (errorMessages.length() == 0)
             {
                 connection.commit();
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java
index fd08bd1749d9cac489695a49683ca40af5ca12da..0ade461f3a4914823206902d4277fd510f182344 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java
@@ -115,7 +115,11 @@ public class ML2DatabaseUploader implements IDataSetUploader
     private DMDataSetDTO createBacklink(DataSetInformation dataSetInformation)
     {
         String datasetPermId = dataSetInformation.getDataSetCode();
-        Sample sample = dataSetInformation.getSample();
+        Sample sample = dataSetInformation.tryToGetSample();
+        if (sample == null)
+        {
+            throw new EnvironmentFailureException("Missing sample in " + dataSetInformation);
+        }
         Experiment experiment = sample.getExperiment();
         String experimentName = findExperimentName(experiment.getProperties());
         String sampleName = findSampleName(sample.getProperties());