fix off-by-one in very confusing mech ordering code