Make sure `$selectedarr` is truly an array.