Fix connection failure on second attempt

Closes #81
Merge pull request #82 from jrschumacher/fix-connection-issue

Fix connection failure on second attempt