diff --git a/SOURCES/0014-Mark-job-goalupgrade-with-sltr-as-targeted.patch b/SOURCES/0014-Mark-job-goalupgrade-with-sltr-as-targeted.patch
new file mode 100644
index 0000000..7519454
--- /dev/null
+++ b/SOURCES/0014-Mark-job-goalupgrade-with-sltr-as-targeted.patch
@@ -0,0 +1,46 @@
+From a9e281087d075f798ac64dad657d34816d533d2a Mon Sep 17 00:00:00 2001
+From: Jaroslav Mracek <jmracek@redhat.com>
+Date: Tue, 3 Sep 2019 11:01:23 +0200
+Subject: [PATCH] Mark job goal.upgrade with sltr as targeted
+
+It allows to keep installed packages in upgrade set.
+
+It also prevents from reinstalling of modified packages with same NEVRA.
+---
+ libdnf/goal/Goal.cpp | 2 +-
+ libdnf/goal/Goal.hpp | 6 ++++--
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/libdnf/goal/Goal.cpp b/libdnf/goal/Goal.cpp
+index b69be19..a38cbb4 100644
+--- a/libdnf/goal/Goal.cpp
++++ b/libdnf/goal/Goal.cpp
+@@ -767,7 +767,7 @@ void
+ Goal::upgrade(HySelector sltr)
+ {
+     pImpl->actions = static_cast<DnfGoalActions>(pImpl->actions | DNF_UPGRADE);
+-    sltrToJob(sltr, &pImpl->staging, SOLVER_UPDATE);
++    sltrToJob(sltr, &pImpl->staging, SOLVER_UPDATE|SOLVER_TARGETED);
+ }
+ 
+ void
+diff --git a/libdnf/goal/Goal.hpp b/libdnf/goal/Goal.hpp
+index f33dfa2..d701317 100644
+--- a/libdnf/goal/Goal.hpp
++++ b/libdnf/goal/Goal.hpp
+@@ -86,8 +86,10 @@ public:
+     /**
+     * @brief If selector ill formed, it rises std::runtime_error()
+     *
+-    * @param sltr p_sltr: It should contain only upgrades with obsoletes otherwise it can try to
+-    * reinstall installonly packages.
++    * @param sltr p_sltr: It contains upgrade-to packages and obsoletes. The presence of installed
++    * packages prevents reinstalling packages with the same NEVRA but changed contant. To honor repo
++    * priority all relevant packages must be present. To upgrade package foo from priority repo, all
++    * installed and available packages of the foo must be in selector plus obsoletes of foo.
+     */
+     void upgrade(HySelector sltr);
+     void userInstalled(DnfPackage *pkg);
+--
+libgit2 0.28.2
+
diff --git a/SOURCES/0015-Apply-targeted-upgrade-only-for-selector-with-packages.patch b/SOURCES/0015-Apply-targeted-upgrade-only-for-selector-with-packages.patch
new file mode 100644
index 0000000..dd92606
--- /dev/null
+++ b/SOURCES/0015-Apply-targeted-upgrade-only-for-selector-with-packages.patch
@@ -0,0 +1,34 @@
+From c235dae84d1b45911f6de1c5d31fedf4856c0d42 Mon Sep 17 00:00:00 2001
+From: Jaroslav Mracek <jmracek@redhat.com>
+Date: Wed, 11 Sep 2019 13:26:43 +0200
+Subject: [PATCH] Apply targeted upgrade only for selector with packages
+
+It resolves problem when selector with name filter is used. Then
+targeted transaction ignores obsoletes.
+
+Closes: #793
+Approved by: jrohel
+---
+ libdnf/goal/Goal.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/libdnf/goal/Goal.cpp b/libdnf/goal/Goal.cpp
+index a38cbb4..88e7b8c 100644
+--- a/libdnf/goal/Goal.cpp
++++ b/libdnf/goal/Goal.cpp
+@@ -767,7 +767,11 @@ void
+ Goal::upgrade(HySelector sltr)
+ {
+     pImpl->actions = static_cast<DnfGoalActions>(pImpl->actions | DNF_UPGRADE);
+-    sltrToJob(sltr, &pImpl->staging, SOLVER_UPDATE|SOLVER_TARGETED);
++    auto flags = SOLVER_UPDATE;
++    if (sltr->getPkgs()) {
++        flags |= SOLVER_TARGETED;
++    }
++    sltrToJob(sltr, &pImpl->staging, flags);
+ }
+ 
+ void
+--
+libgit2 0.28.2
+
diff --git a/SPECS/libdnf.spec b/SPECS/libdnf.spec
index adbe77a..f1d8ff8 100644
--- a/SPECS/libdnf.spec
+++ b/SPECS/libdnf.spec
@@ -1,7 +1,7 @@
 %global libsolv_version 0.7.4-1
 %global libmodulemd_version 1.6.1
 %global librepo_version 1.10.0
-%global dnf_conflict 4.2.5
+%global dnf_conflict 4.2.7-7
 %global swig_version 3.0.12
 
 %bcond_with valgrind
@@ -38,7 +38,7 @@
 
 Name:           libdnf
 Version:        0.35.1
-Release:        8%{?dist}
+Release:        9%{?dist}
 Summary:        Library providing simplified C and Python API to libsolv
 License:        LGPLv2+
 URL:            https://github.com/rpm-software-management/libdnf
@@ -57,6 +57,8 @@ Patch10:        0010-Use-copy-delete-fallback-if-moving-of-directory-fail.patch
 Patch11:        0011-Expose-dnf_copy_file-and-dnf_copy_recursive-in-priva.patch
 Patch12:        0012-Add-dnf_remove_recursive_v2-that-support-unlink-of-f.patch
 Patch13:        0013-Fix-dnf_move_recursive-for-file-in-fallback-mode.patch
+Patch14:        0014-Mark-job-goalupgrade-with-sltr-as-targeted.patch
+Patch15:        0015-Apply-targeted-upgrade-only-for-selector-with-packages.patch
 
 BuildRequires:  cmake
 BuildRequires:  gcc
@@ -269,6 +271,9 @@ popd
 %endif
 
 %changelog
+* Wed Oct 16 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.35.1-9
+- Prevent reinstalling modified packages with same NEVRA (RhBug:1728252,1644241,1760825)
+
 * Fri Sep 06 2019 Marek Blaha <mblaha@redhat.com> - 0.35.1-8
 - Enhanced fix of moving directories in minimal container (RhBug:1700341)