A fix for https://tracker.moodle.org/browse/CONTRIB-4645

Hi,

I made a fix for the aforementioned bug.

I haven't checked what happens in all different cases, but it shouldn't break what it didn't set out to fix.

EDIT: added another fix for in the latest commit: https://github.com/ndunand/moodle-mod_choicegroup/issues/31

~Jacob