diff --git a/src/mio/exception.py b/src/mio/exception.py
index 94e2328bdd40aefe3e5bc71da1fc0e782fd15e31..b8319887c0b3b1c817874d986cc5907762b7b32d 100755
--- a/src/mio/exception.py
+++ b/src/mio/exception.py
@@ -89,7 +89,13 @@ class CircularDependencyException(MioException):
         MioException.__init__(self,
                               "Circular declaration",
                               detail)
-    
+class NonLocalPath(Exception):
+    def __init__(self, path):
+        self.path = path
+        
+    def __str__(self):
+        return "Non local path %s" % self.path
+        
 def Report(err, decl, action=None):
     traceback.print_exc()
     message = "%s:%s" % (decl._url, decl._line)
diff --git a/src/mio/filecache.py b/src/mio/filecache.py
index 201b8a0d39ce0fe2fdb43c31f622a9abe3ffbbbf..8838d485fd78837ad3090c1f0f57ad7b31ba7791 100755
--- a/src/mio/filecache.py
+++ b/src/mio/filecache.py
@@ -1,11 +1,14 @@
 import atexit
+import calendar
 import os
 import os.path
 import re
 import sys
 import tempfile
-import urllib
+import time
+import urllib2
 import urlparse
+import mio.exception
 
 def join(elements):
     """join and normalize elements to a proper (url) path"""
@@ -69,11 +72,18 @@ def loadfile(path):
         if file:
             cache[name] = file
         else:
+            u = urllib2.urlopen(name)
             f = createfile()
-            u = urllib.urlopen(name)
             f.write(u.read())
             u.close()
             f.close()
+            try:
+                modified = u.info()["Last-Modified"]
+                mtime = calendar.timegm(
+                    time.strptime(modified, "%a, %d %b %Y %H:%M:%S %Z"))
+                os.utime(f.name, (mtime, mtime))
+            except:
+                pass
             cache[name] = f.name
     return cache[name]
 
@@ -90,13 +100,13 @@ def locatefile(path):
         if file:
             cache[name] = file
         else:
-            raise Exception("File is not local")
+            raise mio.exception.NonLocalPath(join(path))
     return cache[name]
 
 def locatedir(path):
     dir = getfile(join(path))
     if not dir:
-        raise Exception("Dir is not local")
+        raise mio.exception.NonLocalPath(join(path))
     return dir
 
 
diff --git a/src/mio/installer.py b/src/mio/installer.py
index 8d70f2ff2f6d12917e9927c89fb42abdef021eb9..8d05d5c281ff5df11f0c3cf9978dde38e4b71669 100755
--- a/src/mio/installer.py
+++ b/src/mio/installer.py
@@ -105,8 +105,12 @@ class Installer:
         
 
     def add_rpm(self, rpm):
-        dir = mio.filecache.locatefile([ os.path.dirname(rpm.decl._url),
-                                         rpm.decl.rpms[0:] ])
+        try:
+            dir = mio.filecache.locatedir([ os.path.dirname(rpm.decl._url),
+                                            rpm.decl.rpms[0:] ])
+        except mio.exception.NonLocalPath, e:
+            dir = e.path
+            
         if not dir in self.rpmdir:
             self.rpmdir.append(dir)
         if rpm in self.rpm:
@@ -149,6 +153,7 @@ class Installer:
                 rpm.append(r.name)
         rpm.sort()
         mio.yum.run(path + self.rpmdir, rpm)
+        #mio.yum.run(self.rpmdir, rpm)
         version_db = mio.rpmDB.VersionDB()
         for r in self.rpm:
             r.new_version = version_db[r.name]
diff --git a/src/mio/yum.py b/src/mio/yum.py
index 78c02453b1c1df8cbb0faa1f25b21b7dfe11921c..ab9d34ede9ba7dc266c5218a5aa5c9dbd7a6e497 100755
--- a/src/mio/yum.py
+++ b/src/mio/yum.py
@@ -18,7 +18,7 @@ def newest_rpm(name):
 def yumdir(path):
     result = []
     for d in path:
-        header_date = 0
+        repo_date = 0
         try:
             file = mio.filecache.loadfile([ d, 'repodata/repomd.xml' ])
             if os.path.exists(file):
@@ -29,7 +29,7 @@ def yumdir(path):
         except IOError:
             pass
 
-        repo_date = 0
+        header_date = 0
         try:
             file = mio.filecache.loadfile([ d, 'headers/header.info' ])
             if os.path.exists(file):