Check that ['selected'] is an array to fix #1833