Fix editing of devices

- Store location as stringified json
- Add schema check to devices.
- Add tests and fix privacy checkbox.

Fixes #448 
move :user_id user_id to the next line