Fix tree walking bug with nested inputs.