Minor fix in the rights export query