Fix bug when positive and negative groups are of different lengths