diff --git a/sites/all/modules/unl/unl_migration.php b/sites/all/modules/unl/unl_migration.php
index 14eacf959a81982eb82f03e89975aef0e1f8cf9f..61798278689447fa93bd77f0be8853b4a9f7098a 100644
--- a/sites/all/modules/unl/unl_migration.php
+++ b/sites/all/modules/unl/unl_migration.php
@@ -344,7 +344,7 @@ class Unl_Migration_Tool
             }
             @drupal_mkdir('public://' . dirname($path), NULL, TRUE);
             $file = file_save_data($data['content'], 'public://' . $path, FILE_EXISTS_REPLACE);
-            $this->_hrefTransformFiles[$path] = file_directory_path() . '/' . $path;
+            $this->_hrefTransformFiles[$path] = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . $path;
             return;
         }
         $html = $data['content'];
@@ -568,7 +568,7 @@ class Unl_Migration_Tool
         
         $content = substr($data, $meta['header_size']);
         
-        if ($meta['http_code'] == 301) {
+        if (in_array($meta['http_code'], array(301, 302))) {
             $location = $headers['Location'];
             $path = substr($location, strlen($this->_baseUrl));
             $this->_addSitePath($path);