diff --git a/cmake/BuildSophia.cmake b/cmake/BuildSophia.cmake
index 4cb41d7fab0b5c08f52b8628cb26a079756ec515..1869edc69e17ce307745fc00f8ac0c79996727a7 100644
--- a/cmake/BuildSophia.cmake
+++ b/cmake/BuildSophia.cmake
@@ -7,6 +7,7 @@ macro(sophia_build)
 		add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/third_party/sophia/db/libsophia.a
 			WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/third_party/sophia
 			COMMAND $(MAKE) -C db
+			DEPENDS ${CMAKE_SOURCE_DIR}/CMakeCache.txt
 		)
     else()
         add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/third_party/sophia
diff --git a/src/iproto.cc b/src/iproto.cc
index 560762dcd8bd9d220887bb3709a64c530316a210..83fa53b011ae36a015722706102106f80b72e5e2 100644
--- a/src/iproto.cc
+++ b/src/iproto.cc
@@ -490,6 +490,7 @@ iproto_enqueue_batch(struct iproto_connection *con, struct ibuf *in)
 		const char *pos = reqstart;
 		/* Read request length. */
 		if (mp_typeof(*pos) != MP_UINT) {
+invalid_length:
 			tnt_raise(IllegalParams,
 				  "Invalid MsgPack - packet length");
 		}
@@ -497,7 +498,17 @@ iproto_enqueue_batch(struct iproto_connection *con, struct ibuf *in)
 			break;
 		uint32_t len = mp_decode_uint(&pos);
 
-		/* Skip fixheader */
+		/*
+		 * A hack to support padding after packet length.
+		 */
+		ptrdiff_t need_bytes = IPROTO_FIXHEADER_SIZE - (pos - reqstart);
+		if (need_bytes > 0 && mp_typeof(*pos) == MP_STR) {
+			uint32_t padding;
+			mp_decode_str(&pos, &padding);
+			if (padding + 1 != need_bytes)
+				goto invalid_length;
+		}
+
 		const char *reqend = pos + len;
 		if (reqend > in->end)
 			break;
diff --git a/test/replication/status.test b/test/replication/status.test
deleted file mode 100644
index 759078c4f06190281ffdda0b5c0f64217b48db82..0000000000000000000000000000000000000000
--- a/test/replication/status.test
+++ /dev/null
@@ -1,28 +0,0 @@
-# encoding: tarantool
-import os
-import time
-import re
-from lib.tarantool_server import TarantoolServer
-
-# replica server
-replica = TarantoolServer()
-replica.deploy("replication/cfg/replica.cfg",
-               replica.find_exe(self.args.builddir),
-               os.path.join(self.args.vardir, "replica"))
-
-replica.get_param("lsn")
-
-status = replica.admin.execute_no_reconnect("lua box.info.status", True)
-print(re.search(r'replica/.*/(connecting|connected)\n', status) != None)
-
-server.stop()
-status = replica.admin.execute_no_reconnect("lua box.info.status", True)
-print(re.search(r'replica/.*/(connecting|failed)\n', status) != None)
-
-# Cleanup.
-replica.stop()
-replica.cleanup(True)
-
-server.deploy(self.suite_ini["config"])
-
-# vim: syntax=python
diff --git a/test/replication/status.test.py b/test/replication/status.test.py
new file mode 100644
index 0000000000000000000000000000000000000000..111259af87e50d95545430efab484eebd5e7d47e
--- /dev/null
+++ b/test/replication/status.test.py
@@ -0,0 +1,39 @@
+import os
+import re
+import time
+
+from lib.tarantool_server import TarantoolServer
+
+# master server
+master = server
+# replica server
+replica = TarantoolServer()
+replica.script = "replication/replica.lua"
+replica.rpl_master = master
+replica.vardir = os.path.join(master.vardir, 'replica')
+replica.deploy()
+
+replica.get_param("lsn")
+
+cycles = 0
+status = replica.admin.execute_no_reconnect("box.info.status", True)
+while (re.search(r'replica/.*/(connecting|connected)\n', status) == None and cycles < 500):
+    time.sleep(0.01)
+    status = replica.admin.execute_no_reconnect("box.info.status", True)
+    cycles += 1
+print(re.search(r'replica/.*/(connecting|connected)\n', status) != None)
+
+master.stop()
+cycles = 0
+
+while (re.search(r'replica/.*/(connecting|failed)\n', status) == None and cycles < 500):
+    time.sleep(0.01)
+    status = replica.admin.execute_no_reconnect("box.info.status", True)
+    cycles += 1
+print(re.search(r'replica/.*/(connecting|failed)\n', status) != None)
+
+# Cleanup.
+replica.stop()
+replica.cleanup(True)
+
+master.deploy()