Handle null groups in some edge cases.