diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp
index d8c11cf4b..43446958d 100644
--- a/Telegram/SourceFiles/app.cpp
+++ b/Telegram/SourceFiles/app.cpp
@@ -678,7 +678,7 @@ namespace App {
 					auto h = App::historyLoaded(chat->id);
 					bool found = !h || !h->lastKeyboardFrom;
 					auto botStatus = -1;
-					for (auto i = chat->participants.begin(), e = chat->participants.end(); i != e;) {
+					for (auto i = chat->participants.begin(); i != chat->participants.end();) {
 						auto [user, version] = *i;
 						if (version < pversion) {
 							i = chat->participants.erase(i);
diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp
index 8e2b48cca..fa34f44be 100644
--- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp
+++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp
@@ -932,7 +932,7 @@ void StickersListWidget::refreshSearchRows() {
 }
 
 void StickersListWidget::refreshSearchRows(
-		const std::vector<Stickers::Set*> *cloudSets) {
+		const std::vector<uint64> *cloudSets) {
 	clearSelection();
 
 	_searchSets.clear();
@@ -997,9 +997,12 @@ void StickersListWidget::fillLocalSearchRows(const QString &query) {
 }
 
 void StickersListWidget::fillCloudSearchRows(
-		const std::vector<Stickers::Set*> &sets) {
-	for (const auto set : sets) {
-		addSearchRow(set);
+		const std::vector<uint64> &cloudSets) {
+	const auto &sets = Auth().data().stickerSets();
+	for (const auto setId : cloudSets) {
+		if (const auto it = sets.find(setId); it != sets.end()) {
+			addSearchRow(&*it);
+		}
 	}
 }
 
@@ -1049,7 +1052,7 @@ void StickersListWidget::searchResultsDone(
 	if (it == _searchCache.cend()) {
 		it = _searchCache.emplace(
 			_searchQuery,
-			std::vector<Stickers::Set*>()).first;
+			std::vector<uint64>()).first;
 	}
 	auto &d = result.c_messages_foundStickerSets();
 	for_const (const auto &stickerSet, d.vsets.v) {
@@ -1084,7 +1087,7 @@ void StickersListWidget::searchResultsDone(
 			if (set->stickers.empty() && set->covers.empty()) {
 				continue;
 			}
-			it->second.push_back(set);
+			it->second.push_back(set->id);
 		}
 	}
 	showSearchResults();
diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h
index fc67a24d6..928606794 100644
--- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h
+++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h
@@ -243,9 +243,9 @@ private:
 	void showSearchResults();
 	void searchResultsDone(const MTPmessages_FoundStickerSets &result);
 	void refreshSearchRows();
-	void refreshSearchRows(const std::vector<Stickers::Set*> *cloudSets);
+	void refreshSearchRows(const std::vector<uint64> *cloudSets);
 	void fillLocalSearchRows(const QString &query);
-	void fillCloudSearchRows(const std::vector<Stickers::Set*> &sets);
+	void fillCloudSearchRows(const std::vector<uint64> &cloudSets);
 	void addSearchRow(not_null<const Stickers::Set*> set);
 
 	ChannelData *_megagroupSet = nullptr;
@@ -284,7 +284,7 @@ private:
 	QTimer _previewTimer;
 	bool _previewShown = false;
 
-	std::map<QString, std::vector<Stickers::Set*>> _searchCache;
+	std::map<QString, std::vector<uint64>> _searchCache;
 	std::vector<std::pair<uint64, QStringList>> _searchIndex;
 	base::Timer _searchRequestTimer;
 	QString _searchQuery, _searchNextQuery;
diff --git a/Telegram/SourceFiles/mtproto/connection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp
index 4c24550c7..021cecf59 100644
--- a/Telegram/SourceFiles/mtproto/connection.cpp
+++ b/Telegram/SourceFiles/mtproto/connection.cpp
@@ -1261,11 +1261,17 @@ void ConnectionPrivate::markConnectionOld() {
 
 void ConnectionPrivate::sendPingByTimer() {
 	if (_pingId) {
-		if (_pingSendAt + kPingSendAfterForce - kPingSendAfter - TimeMs(1000) < getms(true)) {
+		// _pingSendAt: when to send next ping (lastPingAt + kPingSendAfter)
+		// could be equal to zero.
+		const auto now = getms(true);
+		const auto mustSendTill = _pingSendAt
+			+ kPingSendAfterForce
+			- kPingSendAfter;
+		if (mustSendTill < now + 1000) {
 			LOG(("Could not send ping for some seconds, restarting..."));
 			return restart();
 		} else {
-			_pingSender.callOnce(_pingSendAt + kPingSendAfterForce - kPingSendAfter - getms(true));
+			_pingSender.callOnce(mustSendTill - now);
 		}
 	} else {
 		emit needToSendAsync();