Fix projection leaf order when the passthrough groups are nested
Use 'while' instead of 'if :)
Ref T437