added error catching for battle