added option to convert set into array if it's single