Make a number of tests more resilient and less racy, and also fix a bug in BasicPool. Closes #45