Fix:  Fix segmentation error when state is declared but not defined.

In finalization of model, a missing state that is declared and not defined cause a segmentation fault.
Added checking of state.  If any state is not defined then error message will warn and exit