add logic to handle missing groups