[[ Bug 10986 ]] Make sure we only select an object if 'before/after' is not specified.
Merge branch 'bugfix-10966' into release-6.1.0