Handle nils correctly
Cosmetics
Fix problem with batches and prepared statements