better handling batch errors