diff --git a/dll/common_includes.h b/dll/common_includes.h
index d4a8635..535d9e8 100644
--- a/dll/common_includes.h
+++ b/dll/common_includes.h
@@ -99,6 +99,11 @@ inline std::wstring utf8_decode(const std::string &str)
     return wstrTo;
 }
 
+inline void reset_LastError()
+{
+    SetLastError(0);
+}
+
 #elif defined(__LINUX__)
     #include <arpa/inet.h>
 
@@ -129,6 +134,7 @@ inline std::wstring utf8_decode(const std::string &str)
     #define PATH_SEPARATOR "/" 
 
     #define utf8_decode(a) a
+    #define reset_LastError()
 #endif
 //#define PRINT_DEBUG(...) fprintf(stdout, __VA_ARGS__)
 #ifdef EMU_RELEASE_BUILD
diff --git a/dll/dll.cpp b/dll/dll.cpp
index 70d91dc..174474d 100644
--- a/dll/dll.cpp
+++ b/dll/dll.cpp
@@ -112,6 +112,7 @@ static void load_old_interface_versions()
     PRINT_DEBUG("networking: %s\n", old_networking);
     PRINT_DEBUG("html surface: %s\n", old_html_surface);
     PRINT_DEBUG("utils: %s\n", old_utils);
+    reset_LastError();
     loaded = true;
 }
 
diff --git a/dll/local_storage.cpp b/dll/local_storage.cpp
index 9ae0a6b..f6ab1fc 100644
--- a/dll/local_storage.cpp
+++ b/dll/local_storage.cpp
@@ -261,6 +261,7 @@ static std::vector<struct File_Data> get_filenames_recursive_w(std::wstring base
         //printf("Failed to find path: %s", strPath.c_str());
     }
 
+    reset_LastError();
     return output;
 }
 
@@ -569,6 +570,7 @@ int Local_Storage::get_file_data(std::string full_path, char *data, unsigned int
     myfile.seekg (offset, std::ios::beg);
     myfile.read (data, max_length);
     myfile.close();
+    reset_LastError();
     return myfile.gcount();
 }
 
@@ -726,6 +728,7 @@ bool Local_Storage::load_json(std::string full_path, nlohmann::json& json)
         PRINT_DEBUG("Couldn't open file \"%s\" to read json\n", full_path.c_str());
     }
 
+    reset_LastError();
     return false;
 }
 
@@ -759,6 +762,7 @@ bool Local_Storage::write_json_file(std::string folder, std::string const&file,
     
     PRINT_DEBUG("Couldn't open file \"%s\" to write json\n", full_path.c_str());
 
+    reset_LastError();
     return false;
 }
 
@@ -774,6 +778,8 @@ std::vector<image_pixel_t> Local_Storage::load_image(std::string const& image_pa
 
         stbi_image_free(img);
     }
+
+    reset_LastError();
     return res;
 }
 
diff --git a/dll/settings_parser.cpp b/dll/settings_parser.cpp
index 4d5fcf3..3aa8ded 100644
--- a/dll/settings_parser.cpp
+++ b/dll/settings_parser.cpp
@@ -588,6 +588,7 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
     *settings_server_out = settings_server;
     *local_storage_out = local_storage;
 
+    reset_LastError();
     return appid;
 }