add a test for invalid value functions
We also clean up the logic for extracting the system parameters from the 'term' parameters. Previously it was done in an ad-hoc way that failed when a user provided invalid value functions.
We also clean up the logic for extracting the system parameters from the 'term' parameters. Previously it was done in an ad-hoc way that failed when a user provided invalid value functions.