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

Can you please merge this pull request also?