when throwing invalid_probability_error, first restore things to a consistent state