Fix editing of devices

- Store location as stringified json
- Add schema check to devices.
- Add tests and fix privacy checkbox.

Fixes #448