fixed a bug: prevented $devices array from having an empty array as the first element