diff --git a/Common/LuaBindings.cpp b/Common/LuaBindings.cpp
index 9fe103c69c2bd2905acca2d94f0ef10195e4c700..ba60955d368cd1b4f80c662b06fc33bfab16cd14 100644
--- a/Common/LuaBindings.cpp
+++ b/Common/LuaBindings.cpp
@@ -138,6 +138,8 @@ static int luaClear (lua_State *L){
 
 int binding::readFile(const char *filename)
 {
+  int lock = CTX::instance()->lock;
+  CTX::instance()->lock = 0;
   checkDocCompleteness();
   int s = luaL_loadfile(L, filename);
   if ( s==0 ) {
@@ -146,6 +148,7 @@ int binding::readFile(const char *filename)
   }
   reportErrors(L, s);
   lua_close(L);
+  CTX::instance()->lock = lock;
   return (s==0);
 }