Fix broken URL for device.js in and change device.js code to work better for testing