fix #1106: search for self as owner

(cherry picked from commit 18ac1a4ea3a9bc9b65babad358fec4e49968890a)
refactoring: do not use an intermediate variable