Handle connection failures. Closes gh-39