Make ruby code more tolerant of order errors
Merge branch 'gchpaco_2788' into next