fix batch implementation