(issue 3890) simplify logic