some minor changes.
Interesting observation: when switching from glpk to solver clp the negative substrate bug occurs again.
However, with the rounding of substrate the code works again.