fix schema resolution for models to flatten out schemas propertly