diff --git a/server.py b/server.py
index 3a1476ed74f187298f077594b63ae642e53d4a4c..c20995db2a13af106c05ee542d47dde516fd3fca 100644
--- a/server.py
+++ b/server.py
@@ -12,6 +12,7 @@ TAG_LIST_NAME = "tags.json"
 
 app = FastAPI()
 
+
 class MapData(BaseModel):
     esri: str
     arucos: List[Dict]
@@ -19,14 +20,16 @@ class MapData(BaseModel):
 
 @app.post("/map")
 async def post_map(the_map: MapData):
-    write_map(the_map)
-    return "ok"
+    result = write_map(the_map)
+    return {"success": result}
 
 
 def write_map(map_data: MapData):
     dir_name = os.getenv("ESRI_OUTPUT_DIRECTORY", default=OUTPUT_DIR)
+    if not os.path.exists(dir_name):
+        os.makedirs(dir_name, exist_ok=True)
     map_filename = path_join(dir_name, MAP_NAME)
-    tag_filename = path_join(dir_name, MAP_NAME)
+    tag_filename = path_join(dir_name, TAG_LIST_NAME)
     with open(map_filename, 'w') as map_file:
         map_file.write(map_data.esri)
     with open(tag_filename, 'w') as tag_file:
@@ -34,6 +37,7 @@ def write_map(map_data: MapData):
             "tags": map_data.arucos
         }
         json.dump(jdic, tag_file)
+    return True
 
 
 def path_join(p, f):