Improve logic as discussed in #923, possibly as in #923 (comment)
—Reply to this email directly or view it on GitHub.