fix_batch_bugs_and_add_batch_tests