diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManager.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManager.java
index b65fe8b4..eda767ba 100644
--- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManager.java
+++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManager.java
@@ -26,7 +26,6 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
-import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Function;
@@ -692,7 +691,6 @@ public List<ThresholdingResult> getPreviewResults(double[][] dataPoints) {
             throw new IllegalArgumentException("Insufficient data for preview results. Minimum required: " + minPreviewSize);
         }
         // Train RCF models and collect non-zero scores
-        Random random = new Random();
         int rcfNumFeatures = dataPoints[0].length;
         RandomCutForest forest = RandomCutForest
             .builder()
diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResult.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResult.java
index 9bce9535..077ba33d 100644
--- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResult.java
+++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResult.java
@@ -88,11 +88,20 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
         XContentBuilder xContentBuilder = builder
             .startObject()
             .field(DETECTOR_ID_FIELD, detectorId)
-            .field(FEATURE_DATA_FIELD, featureData.toArray())
             .field(DATA_START_TIME_FIELD, dataStartTime.toEpochMilli())
-            .field(DATA_END_TIME_FIELD, dataEndTime.toEpochMilli())
-            .field(EXECUTION_START_TIME_FIELD, executionStartTime.toEpochMilli())
-            .field(EXECUTION_END_TIME_FIELD, executionEndTime.toEpochMilli());
+            .field(DATA_END_TIME_FIELD, dataEndTime.toEpochMilli());
+        if (featureData != null) {
+            // can be null during preview
+            xContentBuilder.field(FEATURE_DATA_FIELD, featureData.toArray());
+        }
+        if (executionStartTime != null) {
+            // can be null during preview
+            xContentBuilder.field(EXECUTION_START_TIME_FIELD, executionStartTime.toEpochMilli());
+        }
+        if (executionEndTime != null) {
+            // can be null during preview
+            xContentBuilder.field(EXECUTION_END_TIME_FIELD, executionEndTime.toEpochMilli());
+        }
         if (anomalyScore != null && !anomalyScore.isNaN()) {
             xContentBuilder.field(ANOMALY_SCORE_FIELD, anomalyScore);
         }