type of "data" local variable, which ses2_threshold_ctl_fill returns and uses as paramter to ses2_element_setdef, should be ses2_threshold_impl_t *, but using "&pip[index]" it threats with pip as with array of ses2_threshold_impl_t (that's bug), though pip is actually ses2_threshold_out_page_impl_t *. In order to get pointer to ses2_threshold_impl_t one need to use "&pip->stopi_threasholds[index]".
Unfortunately thresholds do not have any flags like "SELECT" for elements. Elements with non-zero "select" are processed, other ones with zero "select" flag are just ignored. When THRESHOLD_OUT page is sent it is processed as whole, so if you even change only one threshold all other thresholds are considered to be changed too, and you have to load current values for all thresholds before sending page to ensure they won't change its values.
For example, let assume there are 2 thresholds A & B, and we change parameters of A, in this case B values wil be set to zero, because B threshold contains zeros, and otherwise if we change B, A will be set to 0.
A fix for this should copy thresholds from IN page to OUT, so when OUT page is sent all thresholds are consistent.