Improve batch processing

Fix issues with batch histograms and
export to text files.