Fixes a bug with batching