fixes grouping of coreferences

fixed the terrible bug I left in my previous commit