Add more assertions to check groupid consistency