Small fixes for old sqlite and perf boost for sqlite tests.