Fixed multi threaded database access