Fixed a test dependent on concurrency
Fixed a NPE on connection failure
Merge pull request #118 from mads-b/master

Small fixes