fixed bug where device ids weren't properly added and only one device was created