Fixed a test dependent on concurrency
Fixed a NPE on connection failure