Fix batch retry handling, broken in previous refactoring. Fixes #22.