Fix error about sqlite thread access. fix #2352