Fixed bug related to duplicate fields after flattening the inheritance h...

...ierarchy.