Fixed bugs in sparse batch allocator.