Replaced bad workaround with better code similar to code with other optgroup.