diff --git a/question/format/xml/format.php b/question/format/xml/format.php
index 52d91796841..f7ac6b86390 100644
--- a/question/format/xml/format.php
+++ b/question/format/xml/format.php
@@ -1447,10 +1447,8 @@ class qformat_xml extends qformat_default {
$expout .= " " .
$answer->correctanswerlength . "\n";
$expout .= " format($answer->feedbackformat)}>\n";
- $files = $fs->get_area_files($contextid, $component,
- 'instruction', $question->id);
$expout .= $this->writetext($answer->feedback);
- $expout .= $this->write_files($answer->feedbackfiles);
+ $expout .= $this->write_files($this->feedbackfiles[$answer->id]);
$expout .= " \n";
$expout .= "\n";
}