Fixes on batch function