Fix nonsensical constraints in db, and fix a bug with the editor.