diff --git a/mod/scorm/db/upgrade.php b/mod/scorm/db/upgrade.php
index ab33dab..acb5e08 100644
--- a/mod/scorm/db/upgrade.php
+++ b/mod/scorm/db/upgrade.php
@@ -202,8 +202,11 @@ function xmldb_scorm_upgrade($oldversion) {
                     if ($file = $fs->get_file_by_hash($pathnamehash)) {
                         $file_record = array('scontextid'=>$context->id, 'filearea'=>'scorm_pacakge',
                                              'itemid'=>0, 'filepath'=>'/');
-                        $packagefile = $fs->create_file_from_storedfile($file_record, $file);
-                        $scorm->reference = $packagefile->get_filename();
+                        try {
+                            $fs->create_file_from_storedfile($file_record, $file);
+                        } catch (Exception $x) {
+                        }
+                        $scorm->reference = $file->get_filepath().$file->get_filename();
                     } else {
                         $scorm->reference = '';
                     }
