BATCH-2181: Backporting BATCH-2175 to the 2.2.x branch