diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc
index a456e1856..999c47d82 100644
--- a/Telegram/Resources/winrc/Telegram.rc
+++ b/Telegram/Resources/winrc/Telegram.rc
@@ -34,8 +34,8 @@ IDI_ICON1               ICON                    "..\\art\\icon256.ico"
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,10,6,0
- PRODUCTVERSION 0,10,6,0
+ FILEVERSION 0,10,7,0
+ PRODUCTVERSION 0,10,7,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -51,10 +51,10 @@ BEGIN
         BLOCK "040904b0"
         BEGIN
             VALUE "CompanyName", "Telegram Messenger LLP"
-            VALUE "FileVersion", "0.10.6.0"
+            VALUE "FileVersion", "0.10.7.0"
             VALUE "LegalCopyright", "Copyright (C) 2014-2016"
             VALUE "ProductName", "Telegram Desktop"
-            VALUE "ProductVersion", "0.10.6.0"
+            VALUE "ProductVersion", "0.10.7.0"
         END
     END
     BLOCK "VarFileInfo"
diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc
index 34bd669ad..1db28bea8 100644
--- a/Telegram/Resources/winrc/Updater.rc
+++ b/Telegram/Resources/winrc/Updater.rc
@@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,10,6,0
- PRODUCTVERSION 0,10,6,0
+ FILEVERSION 0,10,7,0
+ PRODUCTVERSION 0,10,7,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -43,10 +43,10 @@ BEGIN
         BEGIN
             VALUE "CompanyName", "Telegram Messenger LLP"
             VALUE "FileDescription", "Telegram Updater"
-            VALUE "FileVersion", "0.10.6.0"
+            VALUE "FileVersion", "0.10.7.0"
             VALUE "LegalCopyright", "Copyright (C) 2014-2016"
             VALUE "ProductName", "Telegram Desktop"
-            VALUE "ProductVersion", "0.10.6.0"
+            VALUE "ProductVersion", "0.10.7.0"
         END
     END
     BLOCK "VarFileInfo"
diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h
index 1e2acd471..2153f12b9 100644
--- a/Telegram/SourceFiles/core/version.h
+++ b/Telegram/SourceFiles/core/version.h
@@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
 
 #define BETA_VERSION_MACRO (0ULL)
 
-constexpr int AppVersion = 10006;
-constexpr str_const AppVersionStr = "0.10.6";
+constexpr int AppVersion = 10007;
+constexpr str_const AppVersionStr = "0.10.7";
 constexpr bool AppAlphaVersion = false;
 constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;
diff --git a/Telegram/SourceFiles/ui/emoji_config.h b/Telegram/SourceFiles/ui/emoji_config.h
index 955811f11..a863a51fa 100644
--- a/Telegram/SourceFiles/ui/emoji_config.h
+++ b/Telegram/SourceFiles/ui/emoji_config.h
@@ -173,7 +173,7 @@ inline void appendPartToResult(QString &result, const QChar *start, const QChar
 			if (entity.offset() >= from - start) {
 				entity.extendToLeft(from - start - result.size());
 			}
-			if (entity.offset() + entity.length() < to - start) {
+			if (entity.offset() + entity.length() <= to - start) {
 				entity.shrinkFromRight(from - start - result.size());
 			}
 		}
diff --git a/Telegram/build/makefile_static.sh b/Telegram/build/makefile_static.sh
deleted file mode 100755
index 3aad822f3..000000000
--- a/Telegram/build/makefile_static.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-set -e
-FullExecPath=$PWD
-pushd `dirname $0` > /dev/null
-FullScriptPath=`pwd`
-popd > /dev/null
-
-if [ ! -d "$FullScriptPath/../../../TelegramPrivate" ]; then
-  echo ""
-  echo "This script is for building the production version of Telegram Desktop."
-  echo ""
-  echo "For building custom versions please visit the build instructions page at:"
-  echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
-  exit 1
-fi
-
-Error () {
-  cd $FullExecPath
-  echo "$1"
-  exit 1
-}
-
-if [ ! -f "$FullScriptPath/target" ]; then
-  Error "Build target not found."
-fi
-
-while IFS='' read -r line || [[ -n "$line" ]]; do
-  BuildTarget="$line"
-done < "$FullScriptPath/target"
-
-LocalDirPath="\/usr\/local\/lib"
-if [ "$BuildTarget" == "linux" ]; then
-  ArchDirPath="\/usr\/lib\/x86_64\-linux\-gnu"
-elif [ "$BuildTarget" == "linux32" ]; then
-  ArchDirPath="\/usr\/lib\/i386\-linux\-gnu"
-else
-  Error "Bad build target."
-fi
-
-Replace () {
-    CheckCommand="grep -ci '$1' Makefile"
-    set +e
-    CheckCount=$(eval $CheckCommand)
-    set -e
-    if [ "$CheckCount" -gt 0 ]; then
-        echo "Requested '$1' to '$2', found - replacing.."
-        ReplaceCommand="sed -i'.~' 's/$1/$2/g' Makefile"
-        eval $ReplaceCommand
-    else
-        echo "Skipping '$1' to '$2'"
-    fi
-}
-
-Replace '\-llzma' "$ArchDirPath\/liblzma\.a"
-Replace '\-lXi' "$ArchDirPath\/libXi\.a $ArchDirPath\/libXext\.a"
-Replace '\-lSM' "$ArchDirPath\/libSM\.a"
-Replace '\-lICE' "$ArchDirPath\/libICE\.a"
-Replace '\-lfontconfig' "$ArchDirPath\/libfontconfig\.a $ArchDirPath\/libexpat\.a"
-Replace '\-lfreetype' "$ArchDirPath\/libfreetype\.a"
-Replace '\-lXext' "$ArchDirPath\/libXext\.a"
-Replace '\-lz' "$LocalDirPath\/libz\.a"
-Replace '\-lopus' "$LocalDirPath\/libopus\.a"
-Replace '\-lopenal' "$LocalDirPath\/libopenal\.a"
-Replace '\-lavformat' "$LocalDirPath\/libavformat\.a"
-Replace '\-lavcodec' "$LocalDirPath\/libavcodec\.a"
-Replace '\-lswresample' "$LocalDirPath\/libswresample\.a"
-Replace '\-lswscale' "$LocalDirPath\/libswscale\.a"
-Replace '\-lavutil' "$LocalDirPath\/libavutil\.a"
-Replace '\-lva-x11' "$LocalDirPath\/libva-x11\.a"
-Replace '\-lva-drm' "$LocalDirPath\/libva-drm\.a"
-Replace '\-lva' "$LocalDirPath\/libva\.a"
diff --git a/Telegram/build/version b/Telegram/build/version
index a1bfbfb6e..eefd756f7 100644
--- a/Telegram/build/version
+++ b/Telegram/build/version
@@ -1,6 +1,6 @@
-AppVersion         10006
+AppVersion         10007
 AppVersionStrMajor 0.10
-AppVersionStrSmall 0.10.6
-AppVersionStr      0.10.6
+AppVersionStrSmall 0.10.7
+AppVersionStr      0.10.7
 AlphaChannel       0
 BetaVersion        0
diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi
index 5ef32496a..2a8f0105c 100644
--- a/Telegram/gyp/qt.gypi
+++ b/Telegram/gyp/qt.gypi
@@ -92,8 +92,6 @@
               'Qt5DBus',
               'Qt5Core',
               'qtpcre',
-              'ssl',
-              'crypto',
               'Xi',
               'Xext',
               'SM',
@@ -206,6 +204,8 @@
       'libraries': [
         '/usr/local/lib/libxkbcommon.a',
         '<@(qt_libs_release)',
+        '/usr/local/ssl/lib/libssl.a',
+        '/usr/local/ssl/lib/libcrypto.a',
         'xcb',
         'X11',
         'X11-xcb',