fixed the case where there are no groups