diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php
index 80e2547cb5b..b49e3f655fc 100644
--- a/mod/lesson/locallib.php
+++ b/mod/lesson/locallib.php
@@ -1721,10 +1721,10 @@ class lesson extends lesson_base {
         $this->copy_page_files('page_contents', $pageid, $newlessonpage->id, $context->id);
         $j = 0;
         foreach ($newanswers as $answer) {
-            if (strpos($answer->answer, '@@PLUGINFILE@@') !== false) {
+            if (isset($answer->answer) && strpos($answer->answer, '@@PLUGINFILE@@') !== false) {
                 $this->copy_page_files('page_answers', $answerids[$j], $answer->id, $context->id);
             }
-            if (strpos($answer->response, '@@PLUGINFILE@@') !== false) {
+            if (isset($answer->response) && !is_array($answer->response) && strpos($answer->response, '@@PLUGINFILE@@') !== false) {
                 $this->copy_page_files('page_responses', $answerids[$j], $answer->id, $context->id);
             }
             $j++;
diff --git a/mod/lesson/pagetypes/matching.php b/mod/lesson/pagetypes/matching.php
index b784f8e5e24..a4260f2c814 100644
--- a/mod/lesson/pagetypes/matching.php
+++ b/mod/lesson/pagetypes/matching.php
@@ -118,6 +118,15 @@ class lesson_page_type_matching extends lesson_page {
         $cm = get_coursemodule_from_instance('lesson', $this->lesson->id, $this->lesson->course);
         $context = context_module::instance($cm->id);
 
+        // Check for duplicate response format.
+        $duplicateresponse = array();
+        if (is_array($properties->response_editor[0])) {
+            foreach ($properties->response_editor as $response) {
+                $duplicateresponse[] = $response['text'];
+            }
+            $properties->response_editor = $duplicateresponse;
+        }
+
         $answers = array();
 
         // need to add two to offset correct response and wrong response