Make tests pass, fix typo, optimize a bit.

Use already-computed backend count
In tests, use less likely port numbers
In tests, wait for all backends to finish