Rc2.1

Mostly python changes, and c++ change ( added runtime check to make it harder to generate invalid models)