Fixed a bug with connection pooling