diff --git a/Telegram.sln b/Telegram.sln
index a59887f8a..d33570a0c 100644
--- a/Telegram.sln
+++ b/Telegram.sln
@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 2013
-VisualStudioVersion = 12.0.30110.0
+VisualStudioVersion = 12.0.30501.0
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Telegram", "Telegram\Telegram.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
 	ProjectSection(ProjectDependencies) = postProject
@@ -16,8 +16,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaEmoji", "Telegram\MetaE
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Updater", "Telegram\Updater.vcxproj", "{6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Prepare", "Telegram\Prepare.vcxproj", "{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaLang", "Telegram\MetaLang.vcxproj", "{E417CAA4-259B-4C99-88E3-805F1300E8EB}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2F863EAD-33C9-4014-A573-93F085BA9CB1}"
@@ -71,15 +69,6 @@ Global
 		{6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Release|Win32.ActiveCfg = Release|Win32
 		{6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Release|Win32.Build.0 = Release|Win32
 		{6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}.Release|x64.ActiveCfg = Release|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Debug|Win32.ActiveCfg = Debug|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Debug|Win32.Build.0 = Debug|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Debug|x64.ActiveCfg = Debug|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Deploy|Win32.ActiveCfg = Deploy|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Deploy|Win32.Build.0 = Deploy|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Deploy|x64.ActiveCfg = Release|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Release|Win32.ActiveCfg = Release|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Release|Win32.Build.0 = Release|Win32
-		{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}.Release|x64.ActiveCfg = Release|Win32
 		{E417CAA4-259B-4C99-88E3-805F1300E8EB}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E417CAA4-259B-4C99-88E3-805F1300E8EB}.Debug|Win32.Build.0 = Debug|Win32
 		{E417CAA4-259B-4C99-88E3-805F1300E8EB}.Debug|x64.ActiveCfg = Debug|Win32
diff --git a/Telegram/Prepare.vcxproj b/Telegram/Prepare.vcxproj
deleted file mode 100644
index 7dc896256..000000000
--- a/Telegram/Prepare.vcxproj
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Deploy|Win32">
-      <Configuration>Deploy</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="SourceFiles\_other\prepare.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="SourceFiles\_other\prepare.h" />
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{88AB1138-143A-4CFB-A0E6-79B646B5E1B0}</ProjectGuid>
-    <Keyword>Qt4VSv1.0</Keyword>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120_xp</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120_xp</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <PlatformToolset>v120_xp</PlatformToolset>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup>
-    <_ProjectFileVersion>11.0.61030.0</_ProjectFileVersion>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)IntermediatePrepare\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)IntermediatePrepare\</IntDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
-    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)IntermediatePrepare\</IntDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>UNICODE;WIN32;WIN64;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Optimization>Disabled</Optimization>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <AdditionalIncludeDirectories>.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
-    </ClCompile>
-    <Link>
-      <SubSystem>Console</SubSystem>
-      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
-      <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;shell32.lib;uuid.lib;ole32.lib;advapi32.lib;ws2_32.lib;qtmaind.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>UNICODE;WIN32;WIN64;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <DebugInformationFormat />
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <AdditionalIncludeDirectories>.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
-    </ClCompile>
-    <Link>
-      <SubSystem>Console</SubSystem>
-      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
-      <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;shell32.lib;uuid.lib;ole32.lib;advapi32.lib;ws2_32.lib;qtmain.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">
-    <ClCompile>
-      <PreprocessorDefinitions>UNICODE;WIN32;WIN64;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <DebugInformationFormat>
-      </DebugInformationFormat>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <AdditionalIncludeDirectories>.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
-    </ClCompile>
-    <Link>
-      <SubSystem>Console</SubSystem>
-      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
-      <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>kernel32.lib;user32.lib;shell32.lib;uuid.lib;ole32.lib;advapi32.lib;ws2_32.lib;qtmain.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <GenerateDebugInformation>false</GenerateDebugInformation>
-    </Link>
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-  <ProjectExtensions>
-    <VisualStudio>
-      <UserProperties UicDir=".\GeneratedFiles" MocDir=".\GeneratedFiles\$(ConfigurationName)" MocOptions="" RccDir=".\GeneratedFiles" lupdateOnBuild="0" lupdateOptions="" lreleaseOptions="" Qt5Version_x0020_Win32="$(DefaultQtVersion)" />
-    </VisualStudio>
-  </ProjectExtensions>
-</Project>
\ No newline at end of file
diff --git a/Telegram/Prepare.vcxproj.filters b/Telegram/Prepare.vcxproj.filters
deleted file mode 100644
index c4a106555..000000000
--- a/Telegram/Prepare.vcxproj.filters
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
-      <Extensions>cpp;cxx;c;def</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
-      <Extensions>h</Extensions>
-    </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
-      <Extensions>qrc;*</Extensions>
-      <ParseFiles>false</ParseFiles>
-    </Filter>
-    <Filter Include="Generated Files">
-      <UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
-      <Extensions>moc;h;cpp</Extensions>
-      <SourceControlFiles>False</SourceControlFiles>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="SourceFiles\_other\prepare.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="SourceFiles\_other\prepare.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/Telegram/PrepareWin.bat b/Telegram/PrepareWin.bat
index 8a019fba8..49248c9d8 100644
--- a/Telegram/PrepareWin.bat
+++ b/Telegram/PrepareWin.bat
@@ -1,5 +1,6 @@
 @echo OFF
 
+set "AppVersion=7016"
 set "AppVersionStrSmall=0.7.16"
 set "AppVersionStr=0.7.16"
 set "AppVersionStrFull=0.7.16.0"
@@ -22,6 +23,10 @@ echo.
 echo Preparing version %AppVersionStr%%DevPostfix%..
 echo.
 
+if exist ..\Win32\Deploy\deploy\%AppVersionStr%\ goto error_exist1
+if exist ..\Win32\Deploy\deploy\%AppVersionStr%.dev\ goto error_exist2
+if exist ..\Win32\Deploy\tupdate%AppVersion% goto error_exist3
+
 set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5"
 cd ..\Win32\Deploy
 
@@ -37,12 +42,21 @@ if %errorlevel% neq 0 goto error1
 call ..\..\..\TelegramPrivate\Sign.bat tsetup.%AppVersionStr%%DevPostfix%.exe
 if %errorlevel% neq 0 goto error1
 
-call Prepare.exe -path Telegram.exe -path Updater.exe %DevParam%
+call Packer.exe -version %AppVersion% -path Telegram.exe -path Updater.exe %DevParam%
 if %errorlevel% neq 0 goto error1
 
+if not exist deploy mkdir deploy
+mkdir deploy\%AppVersionStr%%DevPostfix%
+mkdir deploy\%AppVersionStr%%DevPostfix%\Telegram
+
+move Telegram.exe deploy\%AppVersionStr%%DevPostfix%\Telegram\
+move Updater.exe deploy\%AppVersionStr%%DevPostfix%\
+move Telegram.pdb deploy\%AppVersionStr%%DevPostfix%\
+move Updater.pdb deploy\%AppVersionStr%%DevPostfix%\
+move tsetup.%AppVersionStr%%DevPostfix%.exe deploy\%AppVersionStr%%DevPostfix%\
+move tupdate%AppVersion% deploy\%AppVersionStr%%DevPostfix%\
+
 cd deploy\%AppVersionStr%%DevPostfix%
-mkdir Telegram
-move Telegram.exe Telegram\
 7z a -mx9 tportable.%AppVersionStr%%DevPostfix%.zip Telegram\
 if %errorlevel% neq 0 goto error2
 
@@ -60,4 +74,16 @@ cd ..\..\Telegram
 echo ERROR occured!
 exit /b %errorlevel%
 
+:error_exist1
+echo Deploy folder for version %AppVersionStr% already exists!
+exit /b 1
+
+:error_exist2
+echo Deploy folder for version %AppVersionStr%.dev already exists!
+exit /b 1
+
+:error_exist3
+echo Update file for version %AppVersion% already exists!
+exit /b 1
+
 :eof
diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp
index deb0ed572..bd1a7df10 100644
--- a/Telegram/SourceFiles/_other/packer.cpp
+++ b/Telegram/SourceFiles/_other/packer.cpp
@@ -253,7 +253,12 @@ int main(int argc, char *argv[])
 
 	size_t compressedLen = compressed.size() - hSize;
 	size_t outPropsSize = LZMA_PROPS_SIZE;
-	int res = LzmaCompress((uchar*)(compressed.data() + hSize), &compressedLen, (const uchar*)(result.constData()), result.size(), (uchar*)(compressed.data() + hSigLen + hShaLen), &outPropsSize, 9, 64 * 1024 * 1024, 0, 0, 0, 0, 0);
+	uchar *_dest = (uchar*)(compressed.data() + hSize);
+	size_t *_destLen = &compressedLen;
+	const uchar *_src = (const uchar*)(result.constData());
+	size_t _srcLen = result.size();
+	uchar *_outProps = (uchar*)(compressed.data() + hSigLen + hShaLen);
+	int res = LzmaCompress(_dest, _destLen, _src, _srcLen, _outProps, &outPropsSize, 9, 64 * 1024 * 1024, 4, 0, 2, 273, 2);
 	if (res != SZ_OK) {
 		cout << "Error in compression: " << res << "\n";
 		return -1;
diff --git a/Telegram/SourceFiles/_other/prepare.cpp b/Telegram/SourceFiles/_other/prepare.cpp
deleted file mode 100644
index 4c05acb57..000000000
--- a/Telegram/SourceFiles/_other/prepare.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-This file is part of Telegram Desktop,
-the official desktop version of Telegram messaging app, see https://telegram.org
-
-Telegram Desktop is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-It is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
-Copyright (c) 2014 John Preston, https://desktop.telegram.org
-*/
-#include "prepare.h"
-
-bool DevChannel = false;
-
-int prepare(QFileInfo f, QStringList paths) {
-	if (paths.isEmpty()) {
-		cout << "No -path args were passed :(\n";
-		return -1;
-	}
-
-	int lastVersion = 0;
-	QString lastVersionStr;
-	QFileInfo last;
-	QFileInfoList l = f.absoluteDir().entryInfoList(QDir::Files);
-	for (QFileInfoList::iterator i = l.begin(), e = l.end(); i != e; ++i) {
-		QRegularExpressionMatch m = QRegularExpression("/tsetup\\.((\\d+)\\.(\\d+)\\.(\\d+))(?:\\.dev)?\\.exe$").match(i->absoluteFilePath());
-		if (!m.hasMatch()) continue;
-
-		int version = m.captured(2).toInt() * 1000000 + m.captured(3).toInt() * 1000 + m.captured(4).toInt();
-		if (version > lastVersion) {
-			lastVersion = version;
-			lastVersionStr = m.captured(1);
-			last = *i;
-		}
-	}
-
-	if (!lastVersion) {
-		cout << "No tsetup.X.Y.Z.exe or tsetup.X.Y.Z.dev.exe found :(\n";
-		return -1;
-	}
-
-	cout << "Last version: " << (lastVersionStr + (DevChannel ? ".dev" : "")).toUtf8().constData() << " (" << lastVersion << "), executing packer..\n";
-
-	QDir dir("deploy/" + lastVersionStr + (DevChannel ? ".dev" : ""));
-	if (dir.exists()) {
-		cout << "Version " << (lastVersionStr + (DevChannel ? ".dev" : "")).toUtf8().constData() << " already exists in /deploy..\n";
-		return -1;
-	} else if (QDir("deploy/" + lastVersionStr + (DevChannel ? "" : ".dev")).exists()) {
-		cout << "Version " << (lastVersionStr + (DevChannel ? "" : ".dev")).toUtf8().constData() << " already exists in /deploy..\n";
-		return -1;
-	}
-
-	QString packer = QString("Packer.exe -version %1").arg(lastVersion);
-	for (QStringList::iterator i = paths.begin(), e = paths.end(); i != e; ++i) {
-		packer += " -path " + *i;
-	}
-	if (DevChannel) packer += " -dev";
-
-	int res = system(packer.toUtf8().constData());
-
-	if (res) return res;
-
-	dir.mkpath(".");
-
-	paths.push_back("Telegram.pdb");
-	paths.push_back("Updater.pdb");
-	paths.push_back("tsetup." + lastVersionStr + (DevChannel ? ".dev" : "") + ".exe");
-	paths.push_back(QString("tupdate%1").arg(lastVersion));
-	for (QStringList::iterator i = paths.begin(), e = paths.end(); i != e; ++i) {
-		if (!QFile::copy(*i, "deploy/" + lastVersionStr + (DevChannel ? ".dev" : "") + "/" + *i)) {
-			cout << "Could not copy " << i->toUtf8().constData() << " to deploy/" << (lastVersionStr + (DevChannel ? ".dev" : "")).toUtf8().constData() << "\n";
-			return -1;
-		}
-		cout << "Copied " << i->toUtf8().constData() << "..\n";
-	}
-	for (QStringList::iterator i = paths.begin(), e = paths.end(); i != e; ++i) {
-		QFile::remove(*i);
-	}
-
-	cout << "Update created in deploy/" << (lastVersionStr + (DevChannel ? ".dev" : "")).toUtf8().constData() << "\n";
-
-	return 0;
-}
-
-int main(int argc, char *argv[])
-{
-	QFileInfo f(argv[0]);
-
-	QStringList paths;
-	for (int i = 1; i < argc; ++i) {
-		if (string(argv[i]) == "-path" && i + 1 < argc) {
-			paths.push_back(QString(argv[i + 1]));
-		} else if (string(argv[i]) == "-dev") {
-			DevChannel = true;
-		}
-	}
-	int res = prepare(f, paths);
-	return res;
-}
diff --git a/Telegram/SourceFiles/_other/prepare.h b/Telegram/SourceFiles/_other/prepare.h
deleted file mode 100644
index b12c1a645..000000000
--- a/Telegram/SourceFiles/_other/prepare.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-This file is part of Telegram Desktop,
-the official desktop version of Telegram messaging app, see https://telegram.org
-
-Telegram Desktop is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-It is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
-Copyright (c) 2014 John Preston, https://desktop.telegram.org
-*/
-#pragma once
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QFileInfo>
-#include <QtCore/QFile>
-#include <QtCore/QDir>
-#include <QtCore/QStringList>
-#include <QtCore/QBuffer>
-#include <QtCore/QRegularExpression>
-#include <QtCore/QVector>
-
-#include <process.h>
-#include <stdlib.h>
-
-#include <string>
-#include <iostream>
-#include <exception>
-using std::string;
-using std::wstring;
-using std::cout;
\ No newline at end of file
diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp
index 622b09c6e..f9099a1f6 100644
--- a/Telegram/SourceFiles/window.cpp
+++ b/Telegram/SourceFiles/window.cpp
@@ -329,7 +329,7 @@ NotifyWindow::~NotifyWindow() {
 	if (App::wnd()) App::wnd()->notifyShowNext(this);
 }
 
-Window::Window(QWidget *parent) : PsMainWindow(parent), _serviceHistoryRequest(0),
+Window::Window(QWidget *parent) : PsMainWindow(parent), _serviceHistoryRequest(0), title(0),
 intro(0), main(0), settings(0), layerBG(0), _isActive(false), _topWidget(0),
 _connecting(0), _clearManager(0), dragging(false), _inactivePress(false), _mediaView(0) {
 
@@ -1034,6 +1034,8 @@ TitleWidget *Window::getTitle() {
 }
 
 void Window::resizeEvent(QResizeEvent *e) {
+	if (!title) return;
+
 	bool wideMode = (width() >= st::wideModeWidth);
 	if (wideMode != cWideMode()) {
 		cSetWideMode(wideMode);
diff --git a/Telegram/_qt_5_4_0_patch.diff b/Telegram/_qt_5_4_0_patch.diff
index 3f09d4b51..2b2a901a5 100644
--- a/Telegram/_qt_5_4_0_patch.diff
+++ b/Telegram/_qt_5_4_0_patch.diff
@@ -647,7 +647,7 @@ index f1f472b..97819dd 100644
  {
      m_data.setSelectedNameFilter(f); // Dialog cannot be updated at run-time.
 diff --git a/qtbase/src/plugins/platforms/windows/qwindowskeymapper.cpp b/qtbase/src/plugins/platforms/windows/qwindowskeymapper.cpp
-index ff9ad18..ba423b4 100644
+index ff9ad18..3fd0848 100644
 --- a/qtbase/src/plugins/platforms/windows/qwindowskeymapper.cpp
 +++ b/qtbase/src/plugins/platforms/windows/qwindowskeymapper.cpp
 @@ -537,17 +537,16 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer,
@@ -678,6 +678,18 @@ index ff9ad18..ba423b4 100644
          code = unicodeBuffer[0].toUpper().unicode();
  
      // Qt::Key_*'s are not encoded below 0x20, so try again, and DEL keys (0x7f) is encoded with a
+@@ -833,7 +832,10 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
+ 
+     const int qtKey = CmdTbl[cmd];
+     sendExtendedPressRelease(receiver, qtKey, Qt::KeyboardModifier(state), 0, 0, 0);
+-    return true;
++	// QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise,
++	// the keys are not passed to the active media player.
++	const QKeySequence sequence(Qt::Modifier(state) + qtKey);
++	return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence);
+ #else
+     Q_UNREACHABLE();
+     return false;
 diff --git a/qtbase/src/plugins/platforms/windows/qwindowswindow.cpp b/qtbase/src/plugins/platforms/windows/qwindowswindow.cpp
 index 8a80729..16fda26 100644
 --- a/qtbase/src/plugins/platforms/windows/qwindowswindow.cpp
diff --git a/Telegram/_qt_5_4_0_patch/qtbase/src/plugins/platforms/windows/qwindowskeymapper.cpp b/Telegram/_qt_5_4_0_patch/qtbase/src/plugins/platforms/windows/qwindowskeymapper.cpp
index ba423b430..3fd084829 100644
--- a/Telegram/_qt_5_4_0_patch/qtbase/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/Telegram/_qt_5_4_0_patch/qtbase/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -832,7 +832,10 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
 
     const int qtKey = CmdTbl[cmd];
     sendExtendedPressRelease(receiver, qtKey, Qt::KeyboardModifier(state), 0, 0, 0);
-    return true;
+	// QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise,
+	// the keys are not passed to the active media player.
+	const QKeySequence sequence(Qt::Modifier(state) + qtKey);
+	return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence);
 #else
     Q_UNREACHABLE();
     return false;