[bugfix beta] Fixes #9852 - Inconsistent return value in OrderedSet

Fixes #9852