hotfix for contract violations in sorting