In this paper we analyze the phenomenon of copular inversion (CI) in Catalan, which consists in the copula not agreeing with its subject but with its complement. We claim this is due to the idea that in CI-languages verbs agree with one of their cosubjects, i.e. the GFs that are coreferential with the subject, including the subject itself. In the case of copular sentences, there are two cosubjects the verb may agree with, namely the subject and the predicate; which one the verb agrees with is determined by a set of OT constraints that implement a Person-Number Hierarchy so that the copula agrees with the most marked cosubject. This theory does not affect the analysis of subject-verb agreement in non-copular sentences, as in such cases there is only one cosubject available, the subject itself. In order to integrate these ideas within an LFG framework, we propose a change in how verbal agreement is formalized: we claim that verbs do not specify the person and number features of the subject, but have a special structure, AGR, specifying their own features. An f-structure constraint requires this AGR to be unified with a GF in the sentence, the choice being licensed through an OT ranking of constraints.