Fixed bug in group.next when cursor is at the last child.

When the cursor index was at the end of the children array, it would set the cursor to undefined and get stuck there.