## cherrypick() and aggregate() bug over some variables names ending with 'min' / 'max' / 'log'

Having a lagged variable name ending with 'min', 'max' or 'log' in an equation interacts in unexpected ways with the cherrypick() and aggregation() procedures.

In the joined example: the variable 'xmin' (exogenous) and 'ymax' (endogenous) both appears in the equation for 'ymax' as xmin(-1) and ymax(-2).

Cherrypicking this equation makes superfluous 'x' and 'y' exogenous variables appear in the aggregated model, variables that do not exist in the model. The error seems to stem from the program responsible for the 'exogenous.inc' file creation, where exogenous variables 'x' and 'y' are written.

Trying to run the aggregated model outputted this way will have Dynare complaining about the unknown symbol 'xmin' and the unused 'x' and 'y' variables.

This bug seems to also be triggered by variables names ending with 'max' and 'log'.

See the very simple .mod file attached: TestModel.mod