kvstore: improve interfaces and fix forked sqlite3 driver