Fix self-references on models