Fixed bug with duplicate group name

If you used the same group name multiple times, previously, it would have just used the value stored in the last group (even if it failed to find that group).

Now it will only use the last successfully found group.