Fix prefetch using the wrong database/transaction