Fix issue with trellis and no scan opt

Disabling scan optimization with trellis enabled was leading to
incorrect results