diff --git a/question/engine/upgrade/behaviourconverters.php b/question/engine/upgrade/behaviourconverters.php
index <HASH>..<HASH> 100644
--- a/question/engine/upgrade/behaviourconverters.php
+++ b/question/engine/upgrade/behaviourconverters.php
@@ -112,7 +112,7 @@ abstract class question_behaviour_attempt_updater {
         $step->state = 'todo';
         $step->data = array();
         $step->fraction = null;
-        $step->timecreated = $this->attempt->timestart;
+        $step->timecreated = $this->attempt->timestart ? $this->attempt->timestart : time();
         $step->userid = $this->attempt->userid;
         $this->qtypeupdater->supply_missing_first_step_data($step->data);
         return $step;
diff --git a/question/engine/upgrade/upgradelib.php b/question/engine/upgrade/upgradelib.php
index <HASH>..<HASH> 100644
--- a/question/engine/upgrade/upgradelib.php
+++ b/question/engine/upgrade/upgradelib.php
@@ -209,6 +209,7 @@ class question_engine_attempt_upgrader {
                         question {$questionid} in attempt {$attempt->id} at quiz
                         {$attempt->quiz}, since the session was missing.", $attempt->id);
                 try {
+                    $question = $this->load_question($questionid, $quiz->id);
                     $qas[$questionid] = $this->supply_missing_question_attempt(
                             $quiz, $attempt, $question);
                 } catch (Exception $e) {
MDL-<I> code to deal with missing question_attempts was buggy.