diff --git a/Telegram/SourceFiles/audio.cpp b/Telegram/SourceFiles/audio.cpp
index a074ad3f8..6393fc3dd 100644
--- a/Telegram/SourceFiles/audio.cpp
+++ b/Telegram/SourceFiles/audio.cpp
@@ -2403,7 +2403,7 @@ public:
 	}
 
 	bool open(qint64 position = 0) {
-		if (!AbstractFFMpegLoader::openFile()) {
+		if (!AbstractFFMpegLoader::open()) {
 			return false;
 		}
 
diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp
index 8c3844416..540f83bc6 100644
--- a/Telegram/SourceFiles/history.cpp
+++ b/Telegram/SourceFiles/history.cpp
@@ -2536,13 +2536,14 @@ void History::clear(bool leaveItems) {
 			if (App::wnd() && !App::quiting()) App::wnd()->mediaOverviewUpdated(peer, MediaOverviewType(i));
 		}
 	}
-	for (Blocks::const_iterator i = blocks.cbegin(), e = blocks.cend(); i != e; ++i) {
+	Blocks lst = blocks;
+	blocks.clear();
+	for (Blocks::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
 		if (leaveItems) {
 			(*i)->clear(true);
 		}
 		delete *i;
 	}
-	blocks.clear();
 	if (leaveItems) {
 		lastKeyboardInited = false;
 	} else {
@@ -2698,16 +2699,17 @@ int32 HistoryBlock::geomResize(int32 newWidth, int32 *ytransform, const HistoryI
 }
 
 void HistoryBlock::clear(bool leaveItems) {
+	Items lst = items;
+	items.clear();
 	if (leaveItems) {
-		for (Items::const_iterator i = items.cbegin(), e = items.cend(); i != e; ++i) {
+		for (Items::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
 			(*i)->detachFast();
 		}
 	} else {
-		for (Items::const_iterator i = items.cbegin(), e = items.cend(); i != e; ++i) {
+		for (Items::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
 			delete *i;
 		}
 	}
-	items.clear();
 }
 
 void HistoryBlock::removeItem(HistoryItem *item) {
diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.cpp b/Telegram/SourceFiles/mtproto/mtpConnection.cpp
index 0ef1430e0..e9c8502db 100644
--- a/Telegram/SourceFiles/mtproto/mtpConnection.cpp
+++ b/Telegram/SourceFiles/mtproto/mtpConnection.cpp
@@ -546,21 +546,21 @@ void MTPabstractTcpConnection::socketRead() {
 	}
 
 	do {
-		char *readTo = currentPos;
 		uint32 toRead = packetLeft ? packetLeft : (readingToShort ? (MTPShortBufferSize * sizeof(mtpPrime)-packetRead) : 4);
 		if (readingToShort) {
 			if (currentPos + toRead > ((char*)shortBuffer) + MTPShortBufferSize * sizeof(mtpPrime)) {
 				longBuffer.resize(((packetRead + toRead) >> 2) + 1);
 				memcpy(&longBuffer[0], shortBuffer, packetRead);
-				readTo = ((char*)&longBuffer[0]) + packetRead;
+				currentPos = ((char*)&longBuffer[0]) + packetRead;
+				readingToShort = false;
 			}
 		} else {
 			if (longBuffer.size() * sizeof(mtpPrime) < packetRead + toRead) {
 				longBuffer.resize(((packetRead + toRead) >> 2) + 1);
-				readTo = ((char*)&longBuffer[0]) + packetRead;
+				currentPos = ((char*)&longBuffer[0]) + packetRead;
 			}
 		}
-		int32 bytes = (int32)sock.read(readTo, toRead);
+		int32 bytes = (int32)sock.read(currentPos, toRead);
 		if (bytes > 0) {
 			TCP_LOG(("TCP Info: read %1 bytes").arg(bytes));
 
@@ -573,6 +573,7 @@ void MTPabstractTcpConnection::socketRead() {
 					currentPos = (char*)shortBuffer;
 					packetRead = packetLeft = 0;
 					readingToShort = true;
+					longBuffer.clear();
 				} else {
 					TCP_LOG(("TCP Info: not enough %1 for packet! read %2").arg(packetLeft).arg(packetRead));
 					emit receivedSome();
@@ -602,10 +603,12 @@ void MTPabstractTcpConnection::socketRead() {
 					if (!packetRead) {
 						currentPos = (char*)shortBuffer;
 						readingToShort = true;
+						longBuffer.clear();
 					} else if (!readingToShort && packetRead < MTPShortBufferSize * sizeof(mtpPrime)) {
 						memcpy(shortBuffer, currentPos - packetRead, packetRead);
 						currentPos = (char*)shortBuffer;
 						readingToShort = true;
+						longBuffer.clear();
 					}
 				}
 			}