Fix bug with SQLite morphs saves. Fixes #1004. Fixes #864.