hacking on thread safety in sqlite