entity state tracking fixed possible index error.
improved model context (state tracking) performance (this is a autogen. class, so be careful when generating new model)