fix sqlite error when in a transaction