batch mode fixed, Exit strategy added
trycatch to Casting