add test cases for batch scripts, bug fix for batch scripts