end group is not called correctly