Fix: a couple of bugs in the SQLite backend.