when flattening model, the access to fields was not properly prefixed for variables declared in substates