fix Sqlite reference following Remi Collet 0009-Fix-sqlite-ref.patch but with another implementation to keep the same philosophy as other refs