cleaning up patches, and fixing missing pkey bugs in sqlite3