diff --git a/CMakeLists.txt b/CMakeLists.txt
index abb1fc0992dcdd3383d2d19b2eb47d829d7cec4f..61b72dea17a9d8960954fa0968e280102f83ddd7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,7 +113,7 @@ add_custom_target(tags COMMAND ctags -R -f tags
 #
 set (CPACK_PACKAGE_VERSION_MAJOR "1")
 set (CPACK_PACKAGE_VERSION_MINOR "6")
-set (CPACK_PACKAGE_VERSION_PATCH "5")
+set (CPACK_PACKAGE_VERSION_PATCH "6")
 
 set (PACKAGE_VERSION "")
 
diff --git a/extra/dist/tarantoolctl b/extra/dist/tarantoolctl
index ef78b4df4a4d0f178992778638030b7effd28a11..2a4ba43c3f3d12c9b8e5ca8512bfb5e579743419 100755
--- a/extra/dist/tarantoolctl
+++ b/extra/dist/tarantoolctl
@@ -208,7 +208,7 @@ local function find_default_file()
     --
     -- try to find local dir or user config
     --
-    user_level = check_user_level()
+    local user_level = check_user_level()
     if user_level ~= nil then
         return user_level
     end
@@ -333,7 +333,7 @@ end
 
 function mk_default_dirs(cfg)
     -- create pid_dir
-    pid_dir = fio.dirname(cfg.pid_file)
+    local pid_dir = fio.dirname(cfg.pid_file)
     if fio.stat(pid_dir) == nil then
         mkdir(pid_dir)
     end
@@ -350,7 +350,7 @@ function mk_default_dirs(cfg)
         mkdir(cfg.sophia_dir)
     end
     -- create log_dir
-    log_dir = fio.dirname(cfg.logger)
+    local log_dir = fio.dirname(cfg.logger)
     if log_dir:find('|') == nil and fio.stat(log_dir) == nil then
         mkdir(log_dir)
     end
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d0e39a5469d203ed1fc2285279927e7742cf0d29..bfdb80469f58ac693374dad63f367b216982340e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,6 +29,7 @@ lua_source(lua_sources lua/help.lua)
 lua_source(lua_sources lua/help_en_US.lua)
 lua_source(lua_sources lua/tap.lua)
 lua_source(lua_sources lua/fio.lua)
+lua_source(lua_sources lua/strict.lua)
 lua_source(lua_sources ../third_party/luafun/fun.lua)
 
 add_custom_target(generate_lua_sources
diff --git a/src/box/box.cc b/src/box/box.cc
index 35b4143699987e12584a6f901cbe7d72f3233129..cb871ba1b1851c7a78acd13ded282ae4d77d448a 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -502,6 +502,9 @@ box_load_cfg()
 void
 box_atfork()
 {
+	/* NULL when forking for box.cfg{background = true} */
+	if (recovery == NULL)
+		return;
 	/* box.coredump() forks to save a core. */
 	recovery_atfork(recovery);
 }
diff --git a/src/box/iproto.cc b/src/box/iproto.cc
index b1974c508a90892c11bb1c639ff0dac7cf93b517..6dcebb8758d26e75fa866510a510d7a490be5f30 100644
--- a/src/box/iproto.cc
+++ b/src/box/iproto.cc
@@ -296,32 +296,49 @@ iproto_connection_new(const char *name, int fd, struct sockaddr *addr)
 	return con;
 }
 
+/**
+ * Initiate a connection shutdown. This method may
+ * be invoked many times, and does the internal
+ * bookkeeping to only cleanup resources once.
+ */
 static inline void
 iproto_connection_close(struct iproto_connection *con)
 {
-	int fd = con->input.fd;
-	ev_io_stop(con->loop, &con->input);
-	ev_io_stop(con->loop, &con->output);
-	con->input.fd = con->output.fd = -1;
-	/*
-	 * Discard unparsed data, to recycle the con
-	 * as soon as all parsed data is processed.
-	 */
-	con->iobuf[0]->in.wpos -= con->parse_size;
+	if (evio_has_fd(&con->input)) {
+		/* Clears all pending events. */
+		ev_io_stop(con->loop, &con->input);
+		ev_io_stop(con->loop, &con->output);
+
+		int fd = con->input.fd;
+		/* Make evio_has_fd() happy */
+		con->input.fd = con->output.fd = -1;
+		close(fd);
+		/*
+		 * Discard unparsed data, to recycle the
+		 * connection in net_send_msg() as soon as all
+		 * parsed data is processed.  It's important this
+		 * is done only once.
+		 */
+		con->iobuf[0]->in.wpos -= con->parse_size;
+	}
 	/*
-	 * If the con is not idle, it is destroyed
-	 * after the last request is handled. Otherwise,
-	 * queue a separate msg to run on_disconnect()
-	 * trigger and destroy the connection.
-	 * Sic: the check is mandatory to not destroy a connection
+	 * If the connection has no outstanding requests in the
+	 * input buffer, then no one (e.g. tx thread) is referring
+	 * to it, so it must be destroyed at once. Queue a msg to
+	 * run on_disconnect() trigger and destroy the connection.
+	 *
+	 * Otherwise, it will be destroyed by the last request on
+	 * this connection that has finished processing.
+	 *
+	 * The check is mandatory to not destroy a connection
 	 * twice.
 	 */
 	if (iproto_connection_is_idle(con)) {
+		assert(con->disconnect != NULL);
 		struct iproto_msg *msg = con->disconnect;
 		con->disconnect = NULL;
 		cpipe_push(&tx_pipe, msg);
 	}
-	close(fd);
 }
 
 /**
diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
index 0e4fe51352a1c8c2fb6e4b8a0efae218d4e04c55..78010c597360e57b22e85ceaac3d9b16099b3d7a 100644
--- a/src/box/lua/schema.lua
+++ b/src/box/lua/schema.lua
@@ -1125,7 +1125,7 @@ end
 
 local function chpasswd(uid, new_password)
     local _user = box.space[box.schema.USER_ID]
-    auth_mech_list = {}
+    local auth_mech_list = {}
     auth_mech_list["chap-sha1"] = box.schema.user.password(new_password)
     _user:update({uid}, {{"=", 5, auth_mech_list}})
 end
@@ -1158,7 +1158,7 @@ box.schema.user.create = function(name, opts)
         end
         return
     end
-    auth_mech_list = {}
+    local auth_mech_list = {}
     if opts.password then
         auth_mech_list["chap-sha1"] = box.schema.user.password(opts.password)
     end
@@ -1286,7 +1286,7 @@ local function drop(uid, opts)
         box.schema.func.drop(tuple[1])
     end
     -- if this is a role, revoke this role from whoever it was granted to
-    grants = _priv.index.object:select{'role', uid}
+    local grants = _priv.index.object:select{'role', uid}
     for k, tuple in pairs(grants) do
         revoke(tuple[2], tuple[2], uid)
     end
diff --git a/src/box/lua/tuple.lua b/src/box/lua/tuple.lua
index 7a87974f67f41f159bc32bbd2b203d9f0083d482..92eacb9a2ef04f732cc94809579c73d95593e6a1 100644
--- a/src/box/lua/tuple.lua
+++ b/src/box/lua/tuple.lua
@@ -161,7 +161,7 @@ local function tuple_update(tuple, expr)
     end
     local pexpr, pexpr_end = msgpackffi.encode_tuple(expr)
     local tuple = builtin.boxffi_tuple_update(tuple, pexpr, pexpr_end)
-    if tuple == NULL then
+    if tuple == nil then
         return box.error()
     end
     return tuple_bless(tuple)
diff --git a/src/box/memtx_engine.cc b/src/box/memtx_engine.cc
index 69c77eb26154a9c392c29655a350df5563f122b0..a825a23654f75e209c088671c330b2a061c92e87 100644
--- a/src/box/memtx_engine.cc
+++ b/src/box/memtx_engine.cc
@@ -72,6 +72,7 @@ enum {
 	 * can lead to, and, as a result, the max
 	 * number of new block allocations.
 	 */
+	RESERVE_EXTENTS_BEFORE_DELETE = 8,
 	RESERVE_EXTENTS_BEFORE_REPLACE = 16
 };
 
@@ -178,7 +179,9 @@ memtx_replace_all_keys(struct txn *txn, struct space *space,
 	 * Ensure we have enough slack memory to guarantee
 	 * successful statement-level rollback.
 	 */
-	memtx_index_extent_reserve(RESERVE_EXTENTS_BEFORE_REPLACE);
+	memtx_index_extent_reserve(new_tuple ?
+				   RESERVE_EXTENTS_BEFORE_REPLACE :
+				   RESERVE_EXTENTS_BEFORE_DELETE);
 	uint32_t i = 0;
 	try {
 		/* Update the primary key */
diff --git a/src/lib/salad/bps_tree.h b/src/lib/salad/bps_tree.h
index eb385e87436d9b53af7d690cb962afc94cd0facb..6c231a46a0b7c9ed7234520cccc0096d372e571a 100644
--- a/src/lib/salad/bps_tree.h
+++ b/src/lib/salad/bps_tree.h
@@ -1984,6 +1984,8 @@ bps_tree_debug_memmove(void *dst_arg, void *src_arg, size_t num,
 	char *src = (char *)src_arg;
 	struct bps_block *dst_block = (bps_block *)dst_block_arg;
 	struct bps_block *src_block = (bps_block *)src_block_arg;
+	(void) dst_block;
+	(void) src_block;
 
 	assert(dst_block->type == src_block->type);
 	assert(dst_block->type == BPS_TREE_BT_LEAF ||
@@ -1991,6 +1993,8 @@ bps_tree_debug_memmove(void *dst_arg, void *src_arg, size_t num,
 	if (dst_block->type == BPS_TREE_BT_LEAF) {
 		struct bps_leaf *dst_leaf = (struct bps_leaf *)dst_block_arg;
 		struct bps_leaf *src_leaf = (struct bps_leaf *)src_block_arg;
+		(void) dst_leaf;
+		(void) src_leaf;
 		if (num) {
 			assert(dst >= ((char *)dst_leaf->elems));
 			assert(dst < ((char *)dst_leaf->elems) +
diff --git a/src/lua/console.lua b/src/lua/console.lua
index 0c0949c5bfdc0b6a461118f805f14a56280f91e0..09948f6bff8d0793c4d648b17a5cc69b6940f0a8 100644
--- a/src/lua/console.lua
+++ b/src/lua/console.lua
@@ -48,7 +48,7 @@ local function format(status, ...)
     return formatter.encode({{error = err }})
 end
 
-function local_format(status, ...)
+local function local_format(status, ...)
     if not status and type(box.cfg) == 'table' then
         box.rollback()
     end
diff --git a/src/lua/init.cc b/src/lua/init.cc
index fde8c08f45fd2fc7badc849e7b27dde01fc942a4..598d04796f3c6144ecf45bfd209c7c48913ee259 100644
--- a/src/lua/init.cc
+++ b/src/lua/init.cc
@@ -70,7 +70,8 @@ struct fiber *script_fiber;
 bool start_loop = true;
 
 /* contents of src/lua/ files */
-extern char uuid_lua[],
+extern char strict_lua[],
+	uuid_lua[],
 	msgpackffi_lua[],
 	fun_lua[],
 	digest_lua[],
@@ -88,6 +89,8 @@ extern char uuid_lua[],
 	fio_lua[];
 
 static const char *lua_modules[] = {
+	/* Make it first to affect load of all other modules */
+	"strict", strict_lua,
 	"tarantool", init_lua,
 	"fiber", fiber_lua,
 	"buffer", buffer_lua,
@@ -383,6 +386,11 @@ tarantool_lua_init(const char *tarantool_bin, int argc, char **argv)
 	}
 	lua_setfield(L, LUA_GLOBALSINDEX, "arg");
 
+#ifdef NDEBUG
+	/* Unload strict after boot in release mode */
+	luaL_dostring(L, "require('strict').off()");
+#endif /* NDEBUG */
+
 	/* clear possible left-overs of init */
 	lua_settop(L, 0);
 	tarantool_L = L;
diff --git a/src/lua/strict.lua b/src/lua/strict.lua
new file mode 100644
index 0000000000000000000000000000000000000000..471493eec726ee29df2cd92952367bf649d10ed1
--- /dev/null
+++ b/src/lua/strict.lua
@@ -0,0 +1,69 @@
+-- strict.lua
+-- checks uses of undeclared global variables
+-- All global variables must be 'declared' through a regular assignment
+-- (even assigning nil will do) in a main chunk before being used
+-- anywhere or assigned to inside a function.
+--
+
+local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget
+
+local mt = {}
+
+mt.__declared = {}
+
+local function what ()
+  local d = getinfo(3, "S")
+  return d and d.what or "C"
+end
+
+mt.__newindex = function (t, n, v)
+  if not mt.__declared[n] then
+    local w = what()
+    if w ~= "main" and w ~= "C" then
+      error("assign to undeclared variable '"..n.."'", 2)
+    end
+    mt.__declared[n] = true
+  end
+  rawset(t, n, v)
+end
+
+mt.__index = function (t, n)
+  if not mt.__declared[n] and what() ~= "C" then
+    error("variable '"..n.."' is not declared", 2)
+  end
+  return rawget(t, n)
+end
+
+local function off()
+    mt.__declared = {}
+    local m = getmetatable(_G)
+    if m == nil then
+        return
+    end
+    if m == mt then
+        setmetatable(_G, nil)
+    else
+        m.__newindex = nil
+        m.__index = nil
+    end
+end
+
+local function on()
+    local m = getmetatable(_G)
+    if  m == mt then
+        return
+    end
+    if m == nil then
+        setmetatable(_G, mt)
+    else
+        m.__newindex = mt.__newindex
+        m.__index = mt.__index
+    end
+end
+
+on()
+
+return {
+    on = on,
+    off = off,
+}
diff --git a/src/lua/utils.cc b/src/lua/utils.cc
index 9c61376e58cd1e8a966abd1b72b3c7951a735b31..6c9d18af65415ab3d0e6487da4bf7f278239e378 100644
--- a/src/lua/utils.cc
+++ b/src/lua/utils.cc
@@ -128,6 +128,7 @@ luaL_setcdatagc(struct lua_State *L, int idx)
 	GCtab *t = cts->finalizer;
 #if !defined(NDEBUG)
 	CType *ct = ctype_raw(cts, cd->ctypeid);
+	(void) ct;
 	assert(ctype_isptr(ct->info) || ctype_isstruct(ct->info) ||
 	       ctype_isrefarray(ct->info));
 #endif /* !defined(NDEBUG) */
diff --git a/test/big/lua/utils.lua b/test/big/lua/utils.lua
index e801cfaf5477795a2cdec275b7679cb4b095eac8..805583f7b8e94b778aa30f4a3dd4e6a55e8a3f0e 100644
--- a/test/big/lua/utils.lua
+++ b/test/big/lua/utils.lua
@@ -14,7 +14,7 @@ function iterate(space_no, index_no, f1, f2, iterator, ...)
 	local tkeys = {};
 	local values = {};
 	local types = space_field_types(space_no);
-	function get_field(tuple, field_no)
+	local function get_field(tuple, field_no)
 		local f = tuple[field_no]
 		if (types[field_no] == 'NUM') then
 			return string.format('%8d', f);
@@ -81,7 +81,7 @@ end
 
 -- sort all rows as strings(not for tables);
 function box.sort(tuples)
-    function compare_tables(t1, t2)
+    local function compare_tables(t1, t2)
         return (tostring(t1) < tostring(t2))
     end
     table.sort(tuples, compare_tables)
diff --git a/test/big/tree_pk.result b/test/big/tree_pk.result
index 9a4b0da3cc0e524ae9d3f6bf7462d710a36cd020..0441b7297d0468557f41ef44a6cdbeb12077463f 100644
--- a/test/big/tree_pk.result
+++ b/test/big/tree_pk.result
@@ -149,7 +149,7 @@ function crossjoin(space0, space1, limit)
             if limit <= 0 then
                 return result
             end
-            newtuple = v0:totable()
+            local newtuple = v0:totable()
             for _, v in v1:pairs() do
                 table.insert(newtuple, v)
             end
diff --git a/test/big/tree_pk.test.lua b/test/big/tree_pk.test.lua
index b1d6a66b28923f940d873fccb5333eb83de92c98..3f754d8f561e0fc3e4805a9f997c4aaff75a4586 100644
--- a/test/big/tree_pk.test.lua
+++ b/test/big/tree_pk.test.lua
@@ -61,7 +61,7 @@ function crossjoin(space0, space1, limit)
             if limit <= 0 then
                 return result
             end
-            newtuple = v0:totable()
+            local newtuple = v0:totable()
             for _, v in v1:pairs() do
                 table.insert(newtuple, v)
             end
diff --git a/test/big/tree_variants.result b/test/big/tree_variants.result
index 5d48efe4e04dfa89a2221c1c477c08ac2bcd0177..b44f99dc95d358763b23225b72c77b9fd7d0d5be 100644
--- a/test/big/tree_variants.result
+++ b/test/big/tree_variants.result
@@ -199,6 +199,6 @@ space:drop()
 sort = nil
 ---
 ...
-sort_cmp = nul
+sort_cmp = nil
 ---
 ...
diff --git a/test/big/tree_variants.test.lua b/test/big/tree_variants.test.lua
index 2508927122e58b8debc7608c38a97d407fcbc775..306379ae38d2afe5bb9628b1cac7d785b3ed8e31 100644
--- a/test/big/tree_variants.test.lua
+++ b/test/big/tree_variants.test.lua
@@ -59,4 +59,4 @@ space:insert{1, 'xxxxxxxxxxx', 2, '', '', '', '', '', 0}
 
 space:drop()
 sort = nil
-sort_cmp = nul
+sort_cmp = nil
diff --git a/test/box/alter.result b/test/box/alter.result
index 0231006ccfada34478cb5a1d8ebc9a44dab8788c..1905502ef6eb501baca0686227713fef9bf755e2 100644
--- a/test/box/alter.result
+++ b/test/box/alter.result
@@ -337,7 +337,7 @@ space:drop()
 auto = box.schema.space.create('auto_original')
 ---
 ...
-auto2 = box.schema.space.create('auto', {id = auto.id})
+box.schema.space.create('auto', {id = auto.id})
 ---
 - error: Duplicate key exists in unique index 'primary' in space '_space'
 ...
@@ -345,10 +345,6 @@ box.schema.space.drop('auto')
 ---
 - error: Illegal parameters, space_id should be a number
 ...
-auto2
----
-- null
-...
 box.schema.space.create('auto_original', {id = auto.id})
 ---
 - error: Space 'auto_original' already exists
diff --git a/test/box/alter.test.lua b/test/box/alter.test.lua
index 28f00974221d4d75dfa4830bc45f8c60712e9403..316f7d480ec6e9f4bf2469bcb64dcbe1c15a6c9c 100644
--- a/test/box/alter.test.lua
+++ b/test/box/alter.test.lua
@@ -122,9 +122,8 @@ space:drop()
 -- gh-57 Confusing error message when trying to create space with a
 -- duplicate id
 auto = box.schema.space.create('auto_original')
-auto2 = box.schema.space.create('auto', {id = auto.id})
+box.schema.space.create('auto', {id = auto.id})
 box.schema.space.drop('auto')
-auto2
 box.schema.space.create('auto_original', {id = auto.id})
 auto:drop()
 
diff --git a/test/box/bad_trigger.result b/test/box/bad_trigger.result
index f31568c9bc53ffaebf17434c3b8cd7aa1e1c1d0a..5d064b7648a11d7d8ca4fb11acab4fc17043835e 100644
--- a/test/box/bad_trigger.result
+++ b/test/box/bad_trigger.result
@@ -3,6 +3,9 @@
  # if on_connect() trigger raises an exception, the connection is dropped
  #
  
+nosuchfunction = nil
+---
+...
 function f1() nosuchfunction() end
 ---
 ...
diff --git a/test/box/bad_trigger.test.py b/test/box/bad_trigger.test.py
index 3615ccb9dfdff7ace242a331f6a5b5673f1d3c8d..7d200b9218583bf0885ada4226bb81f259d26155 100644
--- a/test/box/bad_trigger.test.py
+++ b/test/box/bad_trigger.test.py
@@ -12,6 +12,8 @@ print """
  #
  """
 
+# silence possible error of strict mode
+server.admin("nosuchfunction = nil")
 server.admin("function f1() nosuchfunction() end")
 server.admin("type(box.session.on_connect(f1))")
 
diff --git a/test/box/bsdsocket.result b/test/box/bsdsocket.result
index 7ff73d18ff01fabc0584c0507cecde68d955e5b7..714d91681a8830e7db93e4271e53ad097517f43e 100644
--- a/test/box/bsdsocket.result
+++ b/test/box/bsdsocket.result
@@ -887,7 +887,7 @@ s:close()
 ---
 - true
 ...
-socket.tcp_connect('127.0.0.1', porrt), errno() == errno.ECONNREFUSED
+socket.tcp_connect('127.0.0.1', port), errno() == errno.ECONNREFUSED
 ---
 - null
 - true
diff --git a/test/box/bsdsocket.test.lua b/test/box/bsdsocket.test.lua
index 4e25afbe27606f87898809b2013a80ea5e6a32dd..6fd56f1e99b7979434ab3f1f077eae93a51ac7e9 100644
--- a/test/box/bsdsocket.test.lua
+++ b/test/box/bsdsocket.test.lua
@@ -286,7 +286,7 @@ sc ~= nil
 e == 0
 sc:close()
 s:close()
-socket.tcp_connect('127.0.0.1', porrt), errno() == errno.ECONNREFUSED
+socket.tcp_connect('127.0.0.1', port), errno() == errno.ECONNREFUSED
 
 -- AF_UNIX
 path = '/tmp/tarantool-test-socket'
diff --git a/test/box/crossjoin.result b/test/box/crossjoin.result
index 6a39def7e557264850aa638436f85b9e9882751d..641673c3787a6c5fd3a7ddde750e318d1e8ac6bd 100644
--- a/test/box/crossjoin.result
+++ b/test/box/crossjoin.result
@@ -12,7 +12,7 @@ function crossjoin(space0, space1, limit)
       if limit <= 0 then
         return result
       end
-      newtuple = v0:totable()
+      local newtuple = v0:totable()
       for _, v in v1:pairs() do table.insert(newtuple, v) end
       table.insert(result, newtuple)
       limit = limit - 1
diff --git a/test/box/crossjoin.test.lua b/test/box/crossjoin.test.lua
index 5fc3a61c4b8155d8dce4d7d3285d21dbe4c0d8a0..1e2a9f80515e0847c084b706e853998441d1f88a 100644
--- a/test/box/crossjoin.test.lua
+++ b/test/box/crossjoin.test.lua
@@ -8,7 +8,7 @@ function crossjoin(space0, space1, limit)
       if limit <= 0 then
         return result
       end
-      newtuple = v0:totable()
+      local newtuple = v0:totable()
       for _, v in v1:pairs() do table.insert(newtuple, v) end
       table.insert(result, newtuple)
       limit = limit - 1
diff --git a/test/box/fiber.result b/test/box/fiber.result
index d86c51ba5046a04da565fb3bb3468b6f76315a8a..46f2aa181b62f350a47ac6b232515edc94175716 100644
--- a/test/box/fiber.result
+++ b/test/box/fiber.result
@@ -422,6 +422,9 @@ f = fiber.create(print('hello'))
     ...): bad arguments'
 ...
 -- test passing arguments in and out created fiber
+res = {}
+---
+...
 function r(a, b) res = { a, b } end
 ---
 ...
diff --git a/test/box/fiber.test.lua b/test/box/fiber.test.lua
index 14bd4d6effe210bd2a348cae8bcc2168c1e21bd5..ab6841c1dbd5cd610f97cdad226d8d86dbfe4b71 100644
--- a/test/box/fiber.test.lua
+++ b/test/box/fiber.test.lua
@@ -165,6 +165,7 @@ f==g
 -- arguments to fiber.create
 f = fiber.create(print('hello'))
 -- test passing arguments in and out created fiber
+res = {}
 function r(a, b) res = { a, b } end
 f=fiber.create(r)
 while f:status() == 'running' do fiber.sleep(0) end
diff --git a/test/box/lua/fiber.lua b/test/box/lua/fiber.lua
index 2bc8111f89b0e197042e9686ccffe417043f9527..64977623edb303dd7b9e39bde9ac913de9969454 100644
--- a/test/box/lua/fiber.lua
+++ b/test/box/lua/fiber.lua
@@ -55,7 +55,7 @@ end
 local function tester_task_routine()
     printer_task = fiber.create(printer_task_routine, 5)
 	table.insert(result, "tester: status(printer) = " .. printer_task:status())
-    count = 1
+    local count = 1
     while printer_task:status() ~= "dead" do
 		table.insert(result, "count: " .. tostring(count))
 		table.insert(result, "status: " .. printer_task:status())
diff --git a/test/box/lua/fifo.lua b/test/box/lua/fifo.lua
index ae1cd835b41daa11bba8824d5eb24babb1fa40ea..bb3446179d7b0a2f72ad9ad559174bc7f312f0f7 100644
--- a/test/box/lua/fifo.lua
+++ b/test/box/lua/fifo.lua
@@ -1,7 +1,7 @@
 -- {name, top, bottom, fifo...}
 fifomax = 5
 function find_or_create_fifo(space, name)
-    fifo = space:get{name}
+    local fifo = space:get{name}
     if fifo == nil then
         fifo = {}
         for i = 1, fifomax do table.insert(fifo, 0) end
@@ -10,9 +10,9 @@ function find_or_create_fifo(space, name)
     return fifo
 end
 function fifo_push(space, name, val)
-    fifo = find_or_create_fifo(space, name)
-    top = fifo[2]
-    bottom = fifo[3]
+    local fifo = find_or_create_fifo(space, name)
+    local top = fifo[2]
+    local bottom = fifo[3]
     if top == fifomax+3 then -- % size
         top = 4
     elseif top ~= bottom then -- was not empty
@@ -26,7 +26,7 @@ function fifo_push(space, name, val)
     return space:update({name}, {{'=', 2, top}, {'=', 3, bottom }, {'=', top, val}})
 end
 function fifo_top(space, name)
-    fifo = find_or_create_fifo(space, name)
-    top = fifo[2]
+    local fifo = find_or_create_fifo(space, name)
+    local top = fifo[2]
     return fifo[top]
 end
diff --git a/test/box/on_replace.result b/test/box/on_replace.result
index f431ebb5c4cdc0068d9e8cc4f8aa07b5b640a6d8..42dfc7d79f04134369eaece3e906fd56135bf6fd 100644
--- a/test/box/on_replace.result
+++ b/test/box/on_replace.result
@@ -75,6 +75,12 @@ ts:insert{2, 'b', 'c'}
 ts:get{2}
 ---
 ...
+o = nil
+---
+...
+n = nil
+---
+...
 function save_out(told, tnew) o = told n = tnew end
 ---
 ...
diff --git a/test/box/on_replace.test.lua b/test/box/on_replace.test.lua
index d3c6565a340a420d371b9a6b3803766fae2e9ba1..9f5a15c636f138844759de390c2fb4126f40b876 100644
--- a/test/box/on_replace.test.lua
+++ b/test/box/on_replace.test.lua
@@ -28,6 +28,8 @@ type(ts:on_replace(fail))
 ts:insert{2, 'b', 'c'}
 ts:get{2}
 
+o = nil
+n = nil
 function save_out(told, tnew) o = told n = tnew end
 type(ts:on_replace(save_out, fail))
 ts:insert{2, 'a', 'b', 'c'}
diff --git a/test/box/session.result b/test/box/session.result
index edffc0a900c531f26410d7a848775044f5c7a4c4..0cfabb9b901501ddbce9bad0b98c73e76dc2f915 100644
--- a/test/box/session.result
+++ b/test/box/session.result
@@ -35,6 +35,9 @@ session.id() > 0
 ---
 - true
 ...
+failed = false
+---
+...
 f = fiber.create(function() failed = session.id() == 0 end)
 ---
 ...
diff --git a/test/box/session.test.lua b/test/box/session.test.lua
index fe68b7edc8ecd280baadf45cd3773c96c573aac5..3e758161f7167d85eeb1725a8230a8c69129ee31 100644
--- a/test/box/session.test.lua
+++ b/test/box/session.test.lua
@@ -12,6 +12,7 @@ session.exists(1234567890)
 
 -- check session.id()
 session.id() > 0
+failed = false
 f = fiber.create(function() failed = session.id() == 0 end)
 while f:status() ~= 'dead' do fiber.sleep(0) end
 failed
diff --git a/test/box/strict.result b/test/box/strict.result
new file mode 100644
index 0000000000000000000000000000000000000000..df61b7d4d3690f70741c6701205db2b4b8f035fb
--- /dev/null
+++ b/test/box/strict.result
@@ -0,0 +1,16 @@
+strict = require('strict')
+---
+...
+strict.on()
+---
+...
+if a then a = true end
+---
+- error: '[string "if a then a = true end "]:1: variable ''a'' is not declared'
+...
+strict.off()
+---
+...
+if a then a = true end
+---
+...
diff --git a/test/box/strict.test.lua b/test/box/strict.test.lua
new file mode 100644
index 0000000000000000000000000000000000000000..c1367c8576fefc1f49713f2d1d7d7b89600876a8
--- /dev/null
+++ b/test/box/strict.test.lua
@@ -0,0 +1,5 @@
+strict = require('strict')
+strict.on()
+if a then a = true end
+strict.off()
+if a then a = true end
diff --git a/test/box/transaction.result b/test/box/transaction.result
index 57b1af0b53240523add52d620494509ba5e42510..4291368149314c6e2966a398adcffd35063f31a5 100644
--- a/test/box/transaction.result
+++ b/test/box/transaction.result
@@ -117,6 +117,7 @@ box.rollback();
 index = s:create_index('primary');
 ---
 ...
+t = nil
 function multi()
     box.begin()
     s:auto_increment{'first row'}
@@ -323,7 +324,7 @@ function insert(a) box.space.test:insert(a) end
 function dup_key()
     box.begin()
     box.space.test:insert{1}
-    status, _ = pcall(insert, {1})
+    local status, _ = pcall(insert, {1})
     if not status then
         if box.error.last().code ~= box.error.TUPLE_FOUND then
             box.error.raise()
diff --git a/test/box/transaction.test.lua b/test/box/transaction.test.lua
index 4501c6e6968854fb27a4fd3e4798552768c30123..23ebed4f8da857e3b49e27c3fb8991cf6449a21e 100644
--- a/test/box/transaction.test.lua
+++ b/test/box/transaction.test.lua
@@ -45,6 +45,7 @@ s = box.schema.space.create('test');
 box.begin() index = s:create_index('primary');
 box.rollback();
 index = s:create_index('primary');
+t = nil
 function multi()
     box.begin()
     s:auto_increment{'first row'}
@@ -148,7 +149,7 @@ function insert(a) box.space.test:insert(a) end
 function dup_key()
     box.begin()
     box.space.test:insert{1}
-    status, _ = pcall(insert, {1})
+    local status, _ = pcall(insert, {1})
     if not status then
         if box.error.last().code ~= box.error.TUPLE_FOUND then
             box.error.raise()
diff --git a/test/replication/once.result b/test/replication/once.result
index c63505ab33eeebfeb6c2a1cb815bf756ed37db53..1abc482ac5355ca2a113641592df3f222bb0b2b7 100644
--- a/test/replication/once.result
+++ b/test/replication/once.result
@@ -17,20 +17,23 @@ box.once("key", nil)
 box.once("key", function() end)
 ---
 ...
-function f(arg) if i ~= nil then i = i + arg else i = arg end end
+once  = nil
+---
+...
+function f(arg) if once ~= nil then once = once + arg else once = arg end end
 ---
 ...
 box.once("test", f, 1)
 ---
 ...
-i
+once
 ---
 - 1
 ...
 box.once("test", f, 1)
 ---
 ...
-i
+once
 ---
 - 1
 ...
diff --git a/test/replication/once.test.lua b/test/replication/once.test.lua
index c9440f3f832205be824abffee5eb5d711a7e08d1..b3b62b1ffac3a836accdbfa54eff6ff04b1be239 100644
--- a/test/replication/once.test.lua
+++ b/test/replication/once.test.lua
@@ -4,9 +4,9 @@ box.once("key", "key")
 box.once("key", nil)
 box.once("key", function() end)
 
-
-function f(arg) if i ~= nil then i = i + arg else i = arg end end
+once  = nil
+function f(arg) if once ~= nil then once = once + arg else once = arg end end
 box.once("test", f, 1)
-i
+once
 box.once("test", f, 1)
-i
+once
diff --git a/test/sophia/conflict.lua b/test/sophia/conflict.lua
index d418119a39ff9cbfa2c0fefd1773625eae889f26..d3cc350dac9788dfcc5bf9d6cdb40f349593d475 100644
--- a/test/sophia/conflict.lua
+++ b/test/sophia/conflict.lua
@@ -1,19 +1,19 @@
 
 function test_conflict()
-	s = box.schema.space.create('tester', {engine='sophia'});
-	i = s:create_index('sophia_index', {type = 'tree', parts = {1, 'STR'}});
+	local s = box.schema.space.create('tester', {engine='sophia'});
+	local i = s:create_index('sophia_index', {type = 'tree', parts = {1, 'STR'}});
 
-	commits = 0
-	function conflict()
+	local commits = 0
+	local function conflict()
 		box.begin()
 		s:replace({'test'})
 		box.commit()
 		commits = commits + 1
 	end;
 
-	fiber = require('fiber');
-	f0 = fiber.create(conflict);
-	f1 = fiber.create(conflict); -- conflict
+	local fiber = require('fiber');
+	local f0 = fiber.create(conflict);
+	local f1 = fiber.create(conflict); -- conflict
 	fiber.sleep(0);
 
 	s:drop();
diff --git a/test/sophia/suite.lua b/test/sophia/suite.lua
index b03877c755ad23f58362c66e7f9843a622632254..10c84e3851e67f5357bc39c36ecbe29c059e113e 100644
--- a/test/sophia/suite.lua
+++ b/test/sophia/suite.lua
@@ -18,7 +18,7 @@ function sophia_dir()
 		i = i + 1
 		list[i] = file
 	end
-	return {i, t}
+	return {i}
 end
 
 function sophia_mkdir(dir)
diff --git a/test/wal_off/itr_lt_gt.result b/test/wal_off/itr_lt_gt.result
index 3693de73aeb64eae1862acd5208637f95e070374..dada55038258f294f37e7dcd1a742f1003cef809 100644
--- a/test/wal_off/itr_lt_gt.result
+++ b/test/wal_off/itr_lt_gt.result
@@ -24,7 +24,7 @@ too_longs = {}
 function test_run_itr(itr, key)
     for i=1,50 do
         local gen, param, state = s.index.primary:pairs({key}, {iterator = itr})
-        state, v =  gen(param, state)
+        local state, v =  gen(param, state)
         test_res[itr .. ' ' .. key] = v
     end
 end;
diff --git a/test/wal_off/itr_lt_gt.test.lua b/test/wal_off/itr_lt_gt.test.lua
index d8e605a4dfc01a011335892f1c8e59b6baabf584..7eb82822b555c2df41bfa4fd89f052ed1c96b76c 100644
--- a/test/wal_off/itr_lt_gt.test.lua
+++ b/test/wal_off/itr_lt_gt.test.lua
@@ -12,7 +12,7 @@ too_longs = {}
 function test_run_itr(itr, key)
     for i=1,50 do
         local gen, param, state = s.index.primary:pairs({key}, {iterator = itr})
-        state, v =  gen(param, state)
+        local state, v =  gen(param, state)
         test_res[itr .. ' ' .. key] = v
     end
 end;
diff --git a/test/wal_off/oom.result b/test/wal_off/oom.result
index 8c224bc98ae67463072ed64dd0ddbd1523b73853..2098f2725791a8c293fbd0b9cd55f7db6ab17d32 100644
--- a/test/wal_off/oom.result
+++ b/test/wal_off/oom.result
@@ -171,7 +171,7 @@ function dup_key()
     space:insert{1}
     local i = 1
     while i < 2000 do
-        status, _ = pcall(insert, {1, string.rep('test', i)})
+        local status, _ = pcall(insert, {1, string.rep('test', i)})
         if status then
             error('Unexpected success when inserting a duplicate')
         end
diff --git a/test/wal_off/oom.test.lua b/test/wal_off/oom.test.lua
index f3aa681b37b7816b7ebccf3926996037c5786696..f269c68a689141202c4b3b04f8a2abc1757177b2 100644
--- a/test/wal_off/oom.test.lua
+++ b/test/wal_off/oom.test.lua
@@ -55,7 +55,7 @@ function dup_key()
     space:insert{1}
     local i = 1
     while i < 2000 do
-        status, _ = pcall(insert, {1, string.rep('test', i)})
+        local status, _ = pcall(insert, {1, string.rep('test', i)})
         if status then
             error('Unexpected success when inserting a duplicate')
         end
diff --git a/third_party/luafun b/third_party/luafun
index 3d44c0841dbc93b645546bb13868550089bfa076..726200c73943f8efdade21c79a722a82566ec45f 160000
--- a/third_party/luafun
+++ b/third_party/luafun
@@ -1 +1 @@
-Subproject commit 3d44c0841dbc93b645546bb13868550089bfa076
+Subproject commit 726200c73943f8efdade21c79a722a82566ec45f