Merge "Handle two identical states in the trellis chain" into nextgenv2