Fix for leg numbering bug