maybe this is a problem which is still not fixed.
To add a item to a group I use two lines of code:
group.addMember(item.getName())
item.addGroupName(group.getName())
Without both I see inconsistence in the group membership. You can check this by looking at the group membership from the point of the group and of the item.
group.getMembers
item.getGroupNames