Improve pool tests, a few bug fixes