diff --git a/pacman_mirrors/httpfn.py b/pacman_mirrors/httpfn.py
index 1cfd426aeed968f5dc4b235a5a1563b3f0ce65b9..7a2771da3ca7d1f91e48b749f094fa8107820332 100644
--- a/pacman_mirrors/httpfn.py
+++ b/pacman_mirrors/httpfn.py
@@ -51,11 +51,12 @@ def download_mirrors(config):
         with urlopen(config["url_mirrors_json"]) as response:
             mirrorlist = json.loads(response.read().decode("utf8"), object_pairs_hook=collections.OrderedDict)
         fetchmirrors = True
-        tempfile = "/tmp/mirrors.json"
+        tempfile = config["work_dir"] + "/temp.file"
         jsonfn.json_dump_file(mirrorlist, tempfile)
-        if filefn.compare_files(tempfile, config["mirror_file"]):
-            os.remove(config["mirror_file"])
-            os.rename(tempfile, config["mirror_file"])
+        filecmp.clear_cache()
+        if not filecmp.cmp(tempfile, config["mirror_file"]):
+            jsonfn.json_dump_file(mirrorlist, config["mirror_file"])
+        os.remove(tempfile)
     except (HTTPException, json.JSONDecodeError, URLError):
         pass
     try: