Add tests for Batch Extension.
Fix bug in Batch Extension.