Fix a bug in select widget code