This is much faster than doing one at a time and makes a big difference with some servers. (cherry picked from commit 96e78e4e)