[Fix] restrictToSegment was checking an incorrect condition