Now group_count means the number of refs pointing to the same image from that ref onwards. This is needed because we can index the list of refs at any point when drawing not just at the start of a group. Fixes #6594